Saturday, May 29, 2010

Difference between SPWeb.Users, SPWeb.AllUsers, SPWeb.SiteUsers

MOSS 2007 offers 3 different user collections in the SPWeb object.
  • SPWeb.Users
    This represents the collection of users or user objects who have been explicitly assigned permissions in the Web site . This does not return users who have access through a group.

    Example (C#):
    SPUserCollection users = web.Users;
  • SPWeb.AllUsers
    This gives us the collection of user objects who are either members of the site collection or who have atleast navigated to the site as authenticated members of a domain group in the site.

    Example (C#):
    SPUserCollection users = web.AllUsers;
  • SPWeb.SiteUsers
    This is the collection of all users that belong to the site collection.

    Example (C#):
    SPUserCollection users = web.SiteUsers;
These terms tend to confuse us unless we really know the differences between each one of them.

So I thought it would be nice to write an article stating which is what. Hope this information helps you SharePoint 2007 developers.

Sunday, May 16, 2010

How to Fix Central Administration: Service Unavailable Issue?

While working on MOSS Servers, you all must have faced 2 common issues quite frequently
  1. You receive a "Cannot connect to the configuration database"
  2. Service Unavailable
Basically, the configuration database is where SP stores all information about the SharePoint 2007 installation and the server farm, hence, it is required for the Central Administration to work fine.

Suddenly while you are in the middle of your important SharePoint deployment or configuration, either of these issues will prop up and eat up lengthy hours. Even the easiest solutions to all SharePoint problems i.e. IISReset or Server restart also do not end your miseries.

Hence, I decided, lets apply TRY-CATCH-FINALLY on these issues for once-n-for-all here.


For Issue#1:

Try to run the SharePoint configuration wizard once, follow these steps for the same:

  1. Click Start, click Run, type cmd in the Open box, and then click OK.
  2. Change to the following directory:
    system drive\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\Bin
  3. Run the following command:
    psconfig -cmd upgrade -inplace b2b
The above steps should fix the issue, but if your problem still persists, then check the event logs of your server. Checking those logs will let you know issues such as -
  • Is your SQL server agent running?
  • Credentials (app pool permissions) used for connecting to SQL Server is working or failing?
  • Facing any network issues to be able to connect to DB?
    (this only applies if the SQL is applied on a separate box from MOSS 2007)
  • so on..
For Issue#2:

If even after carrying out the above suggestions, you are not able to track down the problem, then you could unprovision Central Administration and then reprovision it.

This could be easily done via an STSADM command given below:

stsadm.exe -o provisionservice -action start -servicetype Microsoft.SharePoint.Administration.SPWebService -servicename WSS_Administration
 
I sincerely hope this helps you all in fixing this critical MOSS 2007 Central Administration issue.

Wednesday, May 5, 2010

How to backup a DLL from GAC to another directory?

Recently, one of my friends came up with a requirement where she wanted to take a backup of an existing .Net assembly that was already deployed in Global Assembly Cache (GAC) earlier.

When she asked me this question..I thought to myself that this should not be so tough..well it proved so too at the end.

Finally, this is how it could be done (well..one way of achieving this!!)

If you go to Windows  Run Assembly you will see this screenshot













Now, go to the Command Prompt on your system and type
cd windows\assembly ENTER (Key)

Next, type GAC in the CMD prompt, hit ENTER

Suppose, you want to copy "Extensibility" DLL from GAC to another directory, then type cd Extensibility (you can type Ex and press Tab on your keyboard to navigate faster) to enter the folder hierarchy.

Note: This would be your custom DLL instead of "Extensibility"

Press cd + Tab (keyboard) and hit ENTER again.

Once there, we need to copy!!

In CMD window, type: copy extensibility.dll C:\myCustomDir. Hit ENTER key













Go and check in that directory, you will find the Extensibility dll nicely lazing around..

Hope this post helps you all SharePoint 2007 & Dotnet developers as well as admins in doing this simple but at times life-saving act.

LinkWithin

Related Posts with Thumbnails