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.