SiteData.GetWeb Method
Returns site and list metadata, as well as information about the users and site groups for the current SharePoint site.
Namespace: [SiteData Web service]
Web service reference: http://Site/_vti_bin/SiteData.asmx
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetWeb", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetWeb ( _
<OutAttribute> ByRef sWebMetadata As _sWebMetadata, _
<OutAttribute> ByRef vWebs As _sWebWithTime(), _
<OutAttribute> ByRef vLists As _sListWithTime(), _
<OutAttribute> ByRef vFPUrls As _sFPUrl(), _
<OutAttribute> ByRef strRoles As String, _
<OutAttribute> ByRef vRolesUsers As String(), _
<OutAttribute> ByRef vRolesGroups As String() _
) As UInteger
'Usage
Dim instance As SiteData
Dim sWebMetadata As _sWebMetadata
Dim vWebs As _sWebWithTime()
Dim vLists As _sListWithTime()
Dim vFPUrls As _sFPUrl()
Dim strRoles As String
Dim vRolesUsers As String()
Dim vRolesGroups As String()
Dim returnValue As UInteger
returnValue = instance.GetWeb(sWebMetadata, _
vWebs, vLists, vFPUrls, strRoles, _
vRolesUsers, vRolesGroups)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetWeb", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public uint GetWeb(
out _sWebMetadata sWebMetadata,
out _sWebWithTime[] vWebs,
out _sListWithTime[] vLists,
out _sFPUrl[] vFPUrls,
out string strRoles,
out string[] vRolesUsers,
out string[] vRolesGroups
)
Parameters
sWebMetadata
Type: [SiteData Web service]._sWebMetadataMetadata from the current site.
vWebs
Type: []An array containing information about the subsites under the current site, including their URLs and the dates they were last modified.
vLists
Type: []An array containing information about the lists in the current site, including their GUIDS, Boolean values indicating whether they are empty, and the date they were last modified.
vFPUrls
Type: []This parameter is not used but must be passed.
strRoles
Type: System.StringInformation about the site groups on the current site in the following form:
<Roles> <Role ID="1073741825" Name= "Guest" Description="Can view specific lists or document libraries when given permissions." Type="1" /> <Role ID="1073741826" Name= "Reader" Description= "Has read-only access to the Web site." Type="2" /> <Role ID="1073741827" Name= "Contributor" Description= "Can add content to existing document libraries and lists." Type="3" /> <Role ID="1073741828" Name="Web Designer" Description= "Can create lists and document libraries and customize pages in the Web site." Type="4" /> <Role ID="1073741829" Name= "Administrator" Description= "Has full control of the Web site." Type="5" /> </Roles>
vRolesUsers
Type: []String array that contains information about the users for each site group in the following form:
<Users> <User ID="1" Sid="S-1-5-21- 2127521184-1604012920- 1887927527-76687" Name="Display_Name" LoginName="DOMAIN\User_Alias" Email="Email_Address" Notes="" IsSiteAdmin="True" IsDomainGroup="False" /> <User ID="1" Sid="S-1-5-21- 2127521184-1604012920- 1887927527-259353" Name="Display_Name" LoginName="DOMAIN\User_Alias" Email="Email_Address" Notes="" IsSiteAdmin="True" IsDomainGroup="False" /> </Users>
vRolesGroups
Type: []String array that contains information about the cross-site groups that are members of each site group on the site in the following form:
<Groups> <Group ID="4" Name="Group1" Description="Description" OwnerID="1" OwnerIsUser= "True" /> <Group ID="4" Name="Group2" Description="Description" OwnerID="1" OwnerIsUser="True" /> </Groups>
Return Value
Type: System.UInt32
A 32-bit unsigned integer that returns 0 to indicate that the operation has completed.
Remarks
Any parameter of the GetWeb method can be set to a null reference (Nothing in Visual Basic).
Examples
The following code example displays information about each site group on the current site, including users and cross-site groups that are members of each group. This example assumes the existence of a label within the form of a Windows Application.
Dim srvSiteData As New Web_Reference_Name.SiteData()
srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim siteMData As Web_Reference_Name._sWebMetadata = Nothing
Dim siteTime As Web_Reference_Name._sWebWithTime() = Nothing
Dim lstMData As Web_Reference_Name._sListWithTime() = Nothing
Dim urls As Web_Reference_Name._sFPUrl() = Nothing
Dim strSGroups As String
Dim strSGrpUsrs() As String
Dim strSGrpGrps() As String
srvSiteData.GetWeb(siteMData, siteTime, lstMData, urls, strSGroups, strSGrpUsrs, strSGrpGrps)
label1.Text = strSGroups + ControlChars.Lf
Dim usr As String
For Each usr In strSGrpUsrs
label1.Text += usr + ControlChars.Lf
Next usr
Dim grp As String
For Each grp In strSGrpGrps
label1.Text += grp + ControlChars.Lf
Next grp
Web_Reference_Name.SiteData srvSiteData = new Web_Reference_Name.SiteData();
srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials;
Web_Reference_Name._sWebMetadata siteMData = null;
Web_Reference_Name._sWebWithTime[] siteTime = null;
Web_Reference_Name._sListWithTime[] lstMData = null;
Web_Reference_Name._sFPUrl[] urls = null;
string strSGroups;
string[] strSGrpUsrs;
string[] strSGrpGrps;
srvSiteData.GetWeb(out siteMData, out siteTime, out lstMData, out urls,
out strSGroups,out strSGrpUsrs,out strSGrpGrps);
label1.Text = strSGroups + "\n";
foreach (string usr in strSGrpUsrs)
{
label1.Text += usr + "\n";
}
foreach (string grp in strSGrpGrps)
{
label1.Text += grp + "\n";
}