1

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.aspx says

Microsoft.SharePoint.SPSecurity is in
Namespace: Microsoft.SharePoint 
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)

For SharePoint 2013

But when I ILSpy or Object Browser or just try to resolve the reference in Visual Studio, it's not there!

enter image description here

Since I can't find anything about this online, I know this is just me making a major oversight, but what?!?

2 Answers 2

1

If I load a reference to Microsoft.Sharepoint.DLL inside a visual studio project, the added assembly is located at "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.dll".

When inspected with ILSpy this assembly does contain the SPSecurity class.

I'm not quite sure why you don't see it. But the build of the assembly differs from yours.

enter image description here

1
  • I think I must have pulled this same named dll from somewhere else. This one is only like 2.7 mb instead of the correct ~25mb one. Thanks. Dec 5, 2013 at 16:19
2

Here's the answer when you are using sandbox mode to develop, the SPSecurity class can't be accessed. Just use farm solution and you'll find that.

See Inside Microsoft SharePoint 2010
Chapter 4: Sandboxed Solutions (Inside SharePoint 2010)

Understanding Solution Restrictions
Restricting the access of sandboxed solutions to a subset of the Microsoft.SharePoint namespace is intended to prevent solutions from accessing functionality that could destabilize the farm. When sandboxed solutions make calls to the SharePoint object model, the calls are routed through the subset proxy, which in turn makes calls to the full object model. The subset proxy exposes only the following subset of the object model: All of the Microsoft.SharePoint namespace, except

  • SPSite constructor
  • SPSecurity object
  • SPWorkItem and
  • SPWorkItemCollection objects
  • SPAlertCollection.Add method
  • SPAlertTemplateCollection.Add method
  • SPUserSolution and
  • SPUserSolutionCollection objects
  • SPTransformUtilities object
  • Microsoft.SharePoint.Navigation namespace

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.