Use Microsoft. Sharepoint. Administration to manage WSS (SharePoint)

Source: Internet
Author: User
After creating our WSS site, we can use the WSS console to manage the WSS site.

Microsoft also provides the Microsoft. Sharepoint. Administration namespace to provide corresponding management functions for us.

Here is an article on the Microsoft Knowledge Base.

Http://msdn.microsoft.com/library/default.asp? Url =/library/en-US/spptsdk/html/tsansmicrosoft1_pointadministration_sv01027830.asp

With Microsoft. Sharepoint. Administration, we can do almost everything through the console.

Here is an example to illustrate how to use this namespace to manage WSS sites.

The previous article explains how to use the Treeview control on a webpart.

Http://www.cnblogs.com/king_astar/archive/2005/04/05/132662.html

One process is to exclude web_client from The WSS management path.

At that time, our practice was completed through the WSS console. Now let's use the power of code.

Note: If you want to manage your site through Microsoft. Sharepoint. Administration, you must use a global administrator.

First, we will show which WSS management paths are available,
Microsoft. Sharepoint. Administration. spglobaladmin ospglobaladmin = new spglobaladmin ();

// Other sample code

Spvirtualserver olocalhost = ospglobaladmin. openvirtualserver (

New uri ("http: // localhost "));

TEXT = olocalhost. version. tostring ();

Text + = "<br>" + ospglobaladmin. iscurrentuserglobaladmin (). tostring ();

For (INT I = 0; I <olocalhost. config. prefixes. Count; I ++)

{

Text + = "<br>" + olocalhost. config. prefixes [I]. Name + "" + olocalhost. config. prefixes [I]. prefixtype. tostring ();

}


First instantiate a spglobaladmin, global management class,

Determine which virtual server to manage, and note that it is not nearly the same as the WSS management site.

I think Microsoft's model is indeed good.

The host version is displayed, and you can check whether you are a global administrator.

Find the virtual server. Let's take a look at the configuration-Config

Find what we want, prefixes

OK. The first step is to list the managed paths.

Compile and copy to the server.

It is displayed that the security restriction problem occurs, or if you do not care about it before, set it in the web. config file first.
<Trust level = "full" originurl = ""/>

Later I will explain how to avoid the configuration file with level = full.

Continue to refresh the interface. OK, something is coming out.

Okay. Let's try to add webctrl_client To The WSS exclusion path. (Note that the figure shows that webctrl_client has been excluded. We suppose it is not excluded here)

This step is also simple:

We first set global settings to allow insecure updates.

Note: If you do not set the update below, the update cannot be completed.

In addition, if this step is not set, The WSS prompt is

Set allowunsafeupdates of spweb to true. This is a problem because it is not because the administrator of the site has the permission, but the global administrator has the permission.

Please note that we set ospglobaladmin. config. globaladmin

Try

{



Ospglobaladmin. config. globaladmin. allowunsafeupdates = true;



// Olocalhost. config. prefixes. Delete ("rocktestfolder ");


Olocalhost. config. prefixes. Add ("rocktestfolder", Microsoft. Sharepoint. Administration. spprefixtype. Exclusion );

}

Catch (system. Exception ex)

{

TEXT = ex. message;

}

Finally

{

Ospglobaladmin. config. globaladmin. allowunsafeupdates = false;

}


Run successfully.

In addition, if level = Full is not set, how can we modify it,

Wss_minimaltrust.config file,

Add the following code:

<Securityclass name = "sharepointpermission" Description = "Microsoft. Sharepoint. Security. sharepointpermission, Microsoft. Sharepoint. Security, version = 11.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c"/>

<Securityclass name = "environmentpermission" Description = "system. Security. permissions. environmentpermission, mscorlib, version = 1.0.5000.0, culture = neutral, publickeytoken = token"/>

<Ipermission class = "sharepointpermission" version = "1" unrestricted = "true" name = "fulltrust" Description = "allows full access to all resources"/>

<Ipermission class = "environmentpermission" version = "1" unrestricted = "true" name = "fulltrust" Description = "allows full access to all resources"/>


Fix the securitypermission.

<Ipermission

Class = "securitypermission"

Version = "1"

Unrestricted = "true"

/>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.