Tuesday, February 24, 2009

What is the diffrence between AllUsers, SiteUsers, Users ?

In the SPWeb object you have those three properties that sounds a like, but there is a slight diffrence between them -

AllUsers - Returns "almost" all users in the site collection ( including "guests" ).

SiteUsers - Returns all users that are really exist in the site collection, including groups such as "authenticated users" and system accounts and etc.

Users - Returns only the users that appear in that specific web site.

The explanation in the SDK wasn't clear enough ( as for now , before the service packs ).

If you want to check it yourself just run this short code and see the difference.

 

//Open a SPWeb object ( a site collection )

using (SPWeb web = colSites[i].OpenWeb())
{
SPUserCollection colUsers = web.Users;
foreach (SPUser user in colUsers)
{
Console.WriteLine(user.Name);
}
Console.WriteLine("=======================");
SPUserCollection colUsers1 = web.SiteUsers;

foreach (SPUser user in colUsers1)
{
Console.WriteLine(user.Name);
}
Console.WriteLine("=======================");
SPUserCollection colUsers2 = web.AllUsers;

foreach (SPUser user in colUsers2)
{
Console.WriteLine(user.Name);
}


}

Friday, February 13, 2009

How to block SPD from editing your sites ?

When I got into the SharePoint world a few years ago, I was told about the damages frontpage can make to Sharepoint websites ( though it can make some good stuff too ).

So one of the first things I did when I start learning about Moss, it's how to block the option of the end user to edit their website with Sharepoint Designer -

1. Go to the onet.xml file ( it's in the sharepoint hive of course ).
2. Look for the line that starts with - "3. Add the - DisableWebDesignFeatures="wdfopensite"
4. Do an iisreset.

Now, You can't edit your sites with SPD.
Good Luck.

Tuesday, February 10, 2009

Moss Css chart

Very useful link when you need to edit/brand/customize sharepoint sites or just working on the CSS files.

Moss css chart