I got following error...
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.SPListItem.get
Try calling Update () on the list before getting the UniqueID
SPList list = web.Lists["ListName"]; // 2 SPListItem item = list.Items.Add(); item["Title"] = "Test"; item.Update (); list.Update (); Guid itemId = item.UniqueId;