Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Event Handler to Get GUID

  Asked By: Uday    Date: Sep 13    Category: Sharepoint    Views: 1122

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();
}
}

}

Share: 

 

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.




Tagged: