If you’ve done any work with SharePoint and SPAuditEntry, you may have noticed the distinct lack of Create event. Instead, two Update events are created which means some extra processing is required.

For example, after uploading “NewTxtFile.txt” into a document library inside one of my sites, the following Audit Entries showed up.

<AuditEntry>
  <SiteId>9a70a244-1baa-4229-84ac-3f06bccecc7f</SiteId>
  <ItemId>19ce9254-93bc-41ff-9da1-ba5e994bf1c1</ItemId>
  <ItemType>Document</ItemType>
  <UserId>2</UserId>
  <DocLocation>sites/MySiteCollection/MySubsite/Documents/NewTxtFile.txt</DocLocation>
  <LocationType>Url</LocationType>
  <Occurred>1/22/2010 9:17:06 PM</Occurred>
  <Event>Update</Event>
  <EventSource>SharePoint</EventSource>
</AuditEntry>
 
<AuditEntry>
  <SiteId>9a70a244-1baa-4229-84ac-3f06bccecc7f</SiteId>
  <ItemId>f332a82b-17d1-4c31-9726-5259769f2695</ItemId>
  <ItemType>List</ItemType>
  <UserId>2</UserId>
  <DocLocation>sites/MySiteCollection/MySubsite/Documents</DocLocation>
  <LocationType>Url</LocationType>
  <Occurred>1/22/2010 9:17:06 PM</Occurred>
  <Event>Update</Event>
  <EventSource>SharePoint</EventSource>
  <EventData>NewTxtFile.txt</EventData>
</AuditEntry>

Notice the “Occurred” DateTime properties are the same as well the Event. Also, one is an Update for the List and one is an Update for the Document. Using this information, you can then simplify the duplicate Update events into one Create event!

Leave a Reply