16.01.2013 Views

Microsoft Sharepoint Products and Technologies Resource Kit eBook

Microsoft Sharepoint Products and Technologies Resource Kit eBook

Microsoft Sharepoint Products and Technologies Resource Kit eBook

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The SharePointPermission Class<br />

Chapter 33: The Windows SharePoint Services Object Model 933<br />

This code example uses the SharePointPermission class, which represents a custom<br />

permission that controls the ability to access <strong>Microsoft</strong> SharePoint <strong>Products</strong> <strong>and</strong><br />

<strong>Technologies</strong> resources. The SharePointPermission class cannot be inherited.<br />

The constructor of the SharePointPermission class expects, like all code-access<br />

permission objects, a System.Security.Permissions.PermissionState enumeration value.<br />

This value represents a value specifying whether an entity, at creation, should have<br />

full or no access to resources. This value can be set to None to indicate that a<br />

new instance is fully restricted or Unrestricted. Next the code example accesses<br />

the UnsafeSaveOnGet property of the SharePointPermission class to get a value<br />

indicating whether saving to the SharePoint <strong>Products</strong> <strong>and</strong> <strong>Technologies</strong> database<br />

is allowed during an HTTP-GET request. Because this code example uses the<br />

PermissionState.Unrestricted value, it will return True.<br />

SharePointPermission myPermission = new SharePointPermission(PermissionState<br />

.Unrestricted);<br />

output.Write(myPermission.UnsafeSaveOnGet);<br />

Note You can copy this code into the RenderWebPart method of a Web<br />

Part. Remember to import the <strong>Microsoft</strong>.SharePoint.Security namespace.<br />

<strong>Microsoft</strong>.SharePoint.SoapServer Namespace<br />

The <strong>Microsoft</strong>.SharePoint.SoapServer namespace contains classes that implement<br />

the Windows SharePoint Services Web Service on the server. This namespace can be<br />

found in the Windows SharePoint Services assembly (in <strong>Microsoft</strong>.SharePoint.dll).<br />

The numerous methods provided by the Windows SharePoint Services Web service<br />

are designed for accessing content on a site, including methods for working with<br />

lists or site data, as well as methods for customizing meetings, imaging, Document<br />

Workspace sites, or search. In most cases, the members of these classes are not<br />

designed to be called from the server <strong>and</strong> are not tested in this configuration. The<br />

methods provided by a Web service are designed to be called remotely from client<br />

applications. An excellent example of client applications that use the Web services<br />

provided by the <strong>Microsoft</strong>.SharePoint.SoapServer namespace is Office 2003 itself.<br />

The Simple Object Access Protocol (SOAP) interfaces used in these services<br />

provide .NET developers with object models for creating solutions that work with<br />

Windows SharePoint Services remotely from a client or custom application. The interfaces<br />

are integrated with the server-side object models of the Windows SharePoint<br />

Services assembly, <strong>and</strong> their design has been optimized to reduce the number of<br />

roundtrips transacted between client computer <strong>and</strong> server.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!