Several methods of opening a site in the SPS programming model

xiaoxiao2021-03-06  71

Several ways to open the site

1. If you want to open your site, you are using SPWEB and SPControl to open.

Note: I want to reference Microsoft.Sharpoint and Microsoft.Sharpoint.WebControls

SPWEB mysite = spControl.getContextWeb (Context);

2. If you want to access other sites of the current virtual server

SPWEB Site = SPControl.getContextsite (Context) .allwebs [@ "/ c1 / document center /"];

You can also:

SPSite myweb = spControl.getContextsite (Context);

SPWEB mysite = myweb.allwebs [@ "/ c1 / document center /"];

3. Access to different sites of different virtual servers

SPSite SiteCollection = New SPSite ("http://zhouyi1095.test.net/");

SPWEB Site = SiteCollection.allwebs [@ "/ c1 / document center /"];

转载请注明原文地址:https://www.9cbs.com/read-111038.html

New Post(0)