Archive for toukokuu, 2009

Visual Studio 2010 & .NET Framework 4.0 Beta 1 available

Downloads currently available only for MSDN users, but non-MSDN users will be able to download the packages on wednesday!

Info about the new features and download links can be found here.

Sharepoint: Increase maximum size of list templates

If you have ever needed to move/copy “large” document librarys, you’ll know the not so great default setting of template maximum size. By default template can only be 10 Mb, but there’s a way to make it accept more larger templates. Using STSADM you can set the maximum template size to anything you like. In this example it will be set to 500Mb (insert value in Kb).

STSADM –o setproperty –pn max-template-document-size –pv 512000

Microsoft Dynamics CRM 4.0: How to check the version

If your not sure what version (Update Rollup) your CRM 4.0 installation is, here’s how to check it:

  1. Find the server executables from the installation folder (3 files)
    • %installfolder%\Microsoft Dynamics CRM\Microsoft.Crm.Setup.Server.exe (CRM Server)
    • %installfolder%\Microsoft CRM Email\Microsoft.Crm.Setup.Exchange.exe (Email router)
    • %installfolder%\Microsoft CRM SRS Data Connector\Microsoft.Crm.Setup.SrsDataConnector.exe (Reporting Services Data Connector)
  2. Right click on the file and select properties
  3. Change to the Version (2003 R2) or Details (2008) tab
  4. Check the “File version”  and find it from the list below
    • Update Rollup 1 – 4.0.7333.1113
    • Update Rollup 2 – 4.0.7333.1312
    • Update Rollup 3 – 4.0.7333.1408
    • Update Rollup 4 - 4.0.7333.1551
    • Update Rollup 5 – 4.00.7333.1644
    • Update Rollup 6 – 4.00.7333.1750

Programmatically browse and get permissions from sharepoint site

I was “ordered” to go through hundreds of pages and collect permissions from them to create document of current user permissions for auditing. I was too lazy for that and wrote this piece of code that prints the sites name, url and permissions to console and then continues to go through all the sites under the starting site. You can also save the output to a file when running the executable from command line with the pipe command “program.exe > output.txt”.

?View Code CSHARP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
 
class Program
{
static void Main(string[] args)
{
try
{
using (SPSite siteCollection = new SPSite("http://localhost"))
{
using (SPWeb root = siteCollection.OpenWeb("SiteA/"))
{
string indent = string.Empty;
Console.WriteLine(indent + "-----------------------");
Console.WriteLine(subsite.Title + "\t" + subsite.Url);
Console.WriteLine(indent + "-----------------------");
writePermissionsFromSite(root, 1);
WriteSubSites(root, 1);
}
}
}
catch (Exception ex)
{
Console.WriteLine("Exception: " + ex.StackTrace);
}
}
private static void WriteSubSites(SPWeb root, int depth)
{
string indent = string.Empty;
for (int i = 0; i < depth; i++)
{
indent += "\t";
}
foreach (SPWeb subsite in root.Webs)
{
Console.WriteLine(indent + "-----------------------");
Console.WriteLine(indent + subsite.Title + "\t" + subsite.Url);
////Console.WriteLine(indent + subsite.Title);
Console.WriteLine(indent + "-----------------------");
writePermissionsFromSite(subsite, depth + 1);
if(subsite.Webs.Count > 0)
{
WriteSubSites(subsite, depth + 1);
}
}
}
 
private static void writePermissionsFromSite(SPWeb subsite, int depth)
{
string indent = string.Empty;
for (int i = 0; i < depth; i++)
{
indent += "\t";
}
 
if (subsite.Permissions.Inherited)
{
Console.WriteLine(indent + "P: inherited");
}
else
{
string roles = string.Empty;
 
foreach (SPRoleAssignment permission in subsite.RoleAssignments)
{
roles = string.Empty;
foreach (SPRoleDefinition role in permission.RoleDefinitionBindings)
{
 
roles += role.Name + "; ";
}
 
Console.WriteLine(indent + "P: " + permission.Member.Name + " - " + roles);
}
}
}
}

MOSS Access Denied troubleshooting

In case you or your users are experiencing random access denied messages when browsing sharepoint, read this great article written by Tyler Holmes

MOSS 2007, Windows 2008 and HOSTS-file

Sharepoint wants to save it’s address to the computers HOSTS-file (%systemroot%\system32\drivers\etc\HOSTS) and that’s a file that windows server 2008 by default does not even have and really does not want any users writing to it. Even if your user (running sharepoint as admin is not recommended) has admin rights, sharepoint is unable to write anything to the HOSTS-file. You need to take ownership of the folder etc and then add either the sharepoint farm admin or the WSS_ADMIN_WPG group.

Joseph Davis has written a step by step article about this here.