Geeks With Blogs

News
About Me:
I am a Female SharePoint Developer (a platinum unicorn). I have been working with SharePoint since I attended the Portal University in 2005. I hold a BA in Computer Science from the University of Missouri - Kansas City. I love playing Rockband, organizing user group meetings, working with code, attending events as a speaker or organizer, and having bizarre conversations about geek things with cool people. If you have any comments or questions fill out the contact form and I will try my best to help.



The Guide of a MOSSLover Becky Isserman's Blog

The other day I was working with a class that pulls back all the audit information for a user, SPAuditQuery.  It has some really good options, especially query by user.  I was trying to pull information from the site collection for the user, however I continued to receive a non-descript error message.  Finally, I thought to myself what permissions does this user have and sure enough the user was a Site Admin and not Site Collection Admin.  If you are pulling audit logs from a Site, then check that the user is a Site Collection Admin.  If you are pulling audit logs from a web, then you need to make sure that they are a Site Admin.  If you are pulling from a list, then they need to have list admin rights (probably somewhere around the built in permissions “designer” level).  In this case we may not let the person have Site Collection Admin rights, but we may want them to see the log data in a custom webpart.  We can use an alternative with SPSecurity.RunwithElevatedPrivileges and place the webpart in an area secured for only those people to see.

Another key thing to note when working with audit logs you need to turn on the Audit Logs in the Site Collection under Site Settings before you can even begin to hit anything with code.  Otherwise you will receive all kinds of pretty nasty looking error messages.  When dealing with anything I always consider Occam’s Razor – The simplest assumption is probably true.  Initially you should check to see if the audit logs are turned on in the Site Collection, then check permissions.  Good luck guys…As usual I hope that you can learn from my mistakes.

Technorati Tags: ,,
Posted on Wednesday, August 12, 2009 12:01 AM MOSS | Back to top


Comments on this post: Permissions for SPAuditQuery

# re: Permissions for SPAuditQuery
Requesting Gravatar...
Thanks for the info. On a side note; Occam's Razor isn't about selecting the simplest explanation and being done. Its about selecting an explanation that make the fewest assumptions. Simple does not always equal accurate, but the least amount of assumptions does. Thus fewer assumptions appears to be more simple, but not always. The idea behind the "razor" within the principle is to remove assumptions amongst competing explanations, unless necessary.
Left by Json on Sep 06, 2011 10:26 AM

Your comment:
 (will show your gravatar)


Copyright © MOSSLover | Powered by: GeeksWithBlogs.net