Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Event Handler to Get GUID

  Asked By: Uday Bijapur         Date: Sep 13, 2009      Category: Sharepoint      Views: 245
 

I am trying to grap document GUID and display the value to my custom column
called "document Id". When I uploading the document, it works fine. However,
when I tried create a new document, I couldn't get the GUID to save. I stepped
thru the code and I could see the GUID. As soon as I checked-in the document,
the GUID is gone. Here's the code. Can someone please help me. Thanks in
advanced.

public class CreateUniqueID : SPItemEventReceiver
{
public override void ItemAdded(SPItemEventProperties properties)
{
if (properties.ListItem != null)
{
base.ItemAdded(properties);
SPListItem listItem = properties.ListItem;
listItem["Document ID"] =
properties.ListItem.UniqueId.ToString();

listItem.Update();
}
}

}


Do you know someone who can help? Share a link to this thread on twitter, or facebook.

Tagged:          

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Event Handler to Get GUID Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].