Generating Unique IDs in Windows SharePoint Services 3.0


My Solution is here

Con s
The major problem with this technique is concurrency .
2 or more users with fast machines and network connections ( or many queued docuemnts) can cause this to deadlock.

Pro s
Easy to do , easy to deply and staple the feature to the site if you want and makes your life easy , as it is an event handler for on the onCreate or onNew.

Final Solution
I have been in this situation a few times, and here is the final working solution.

Why reinvent the wheel when SharePoint already has a Sequence generator that is Thread safe it is called (SharePoint List )

Simply on every Item you need a a new ID , create an Item in the new List , get the ID and give it to your Document List , announcent , or whatever Items you want Unique ID for.

Code is simple but not public.

Thanks and good luck


http://msdn.microsoft.com/en-us/library/cc303696(office.12).aspx#CommunityContent

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s