Welcome to MSDN Blogs Sign in | Join | Help

Gathering Reporting Data Remotely Using the Web Services

I've been working with the SAT team on a tool with a real 3 pronged approach to asset inventory tracking otherwise known as reporting.

1. Discovery - finding what's out there (Ping, Port Scan, Interogation, SOAP & web service calls, etc...)  Think Vista assessment tool.

2. Migration - You want to know what's out there, once you find it you need to know what's on it, and how much work it's going to be to migrate it.

3. Reporting - Your managing your farms and you want some high level numbers to give you the figures like how many Sites you have across all your farms.

The tool itself will be agentless and will only use the object model to gather the data.

The team working on the project found that there isn't obvious ways to determine:

1. Site Collection vs. Site

2. Site Template (Site Type)

So I set out to figure out how to accomplish this with the data available through the web services.

This isn't going to be 100% accurate since people can change list names, but I thought this was a decent swag.  If you find something better without having to run something local, I'm interested.  It's also useful if you are simply looking at a site's home page and what's in the quick launch to determine what type of site it is or was.  Obviously the more customized a site becomes these won't be accurate.

How to eyeball/guestimate a site template by its default list(s)
Template: “List” example:
My Site: “Private Documents” example: http://my/sites/joelo/Private%20Documents/Forms/AllItems.aspx
Blog: “Posts” example: http://sharepoint/sites/demoblog1/Lists/Posts/Archive.aspx
Wikis: “Wiki Pages” example: http://sharepoint/sites/myquickwiki/Wiki%20Pages/Home.aspx
Portal and Publishing sites: “Pages” example: http://sharepoint/sites/CPortal/Pages/Default.aspx
Portal: Has a web that’s called “Document Center” example: http://sharepoint/sites/CPortal/News/Pages/newsarchive.aspx
Meeting workspace: “Objectives” example: http://sharepoint/sites/capacityplanning/MWS/Lists/Objectives/AllItems.aspx
Team and Document Workspace: “Team Discussion” or “Calendar” but does not have “Pages”

In my search Stacy Draper turned me on to this one, look at example 3 which appears to have a way to get templates from the web services: Talk to SharePoint through its web services 

Determine the site type by looking at Activated Features. 
Without even going that low, looks like you can also get close by simply looking at activated features: From _vti_bin/Webs.asmx web service
GetActivatedFeatures

To determine if it’s a Site collection (SPSite) or a site (SPWeb)
Note: the _Catalog/ and _layouts lists and pages appear hidden or are not accessible via the Web Services 

Web Template catalog (This only lives on a site collection)

http://my/sites/joelo/_catalogs/wt/Forms/Common.aspx

 

The Master Page Gallery

http://my/sites/joelo/_catalogs/masterpage/Forms/AllItems.aspx

 

Form Templates library (appears MOSS only with certain features activated, so not the best candidate)

http://my/sites/joelo/FormServerTemplates/Forms/All Forms.aspx

 

Site Collections also have quotas, they also have recycle bins, but you can't seem to get that info from the web services that I've looked at. 

 

 

Some SharePoint URL Logic off the top of my head.  Please improve on it if you can.

 

http:// %web app%/%inclusion or site or site collection%/%site or site collection%/%site and always a site%

 

1.       In the URL above the web app is always a web app

2.       The 2nd level is

a.       99% a site if not called /sites or /personal (not that many (especially in count) custom inclusions out there)

b.      99.99% of /sites or /personal are inclusion paths

c.       .1% smart admin creates explicit inclusion and creates a site collection (very rare)

d.      1% or less custom inclusion paths, but you won’t find any web services on them.

3.       The 3rd level

a.       if 2nd level is an inclusion path of /sites or /personal then this level is a site collection 100%

b.      if 2nd level is not /sites or /personal then it is most likely a site

4.       the 4th level and below

a.       always a site

  

Excellent Web Services Resource with Samples:

Talk to SharePoint through its web services csharp help from Claus Salchner (Thanks Stacy Draper for this tip.)  Has examples and downloable code.  Best resource I came across.

Step By Step updating a list with web services using C#

SharePoint Web Services a VB.NET example with Screenshots (written for 2003, but still applicable)

 

XML is cool I don't know why I didn't find more examples when trolling for examples of web service responses, as an IT Pro I don't want to have to generate my own request and response, I want to know what I can get from the various web services.  If I'm looking for file size, I'd hope or expect to find an example.  I don't see this as Spam, but maybe some spiders do.

Here's the sample SOAP response for GetListItems on a Style library.

  <?xml version="1.0" encoding="utf-8" ?>
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <soap:Body>
- <GetListItemsResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
- <GetListItemsResult>
- <listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
- <rs:data ItemCount="8">
  <z:row ows_LinkFilename="en-us" ows_Modified="2007-10-17 16:06:01" ows_Editor="1;#Bsd Hugsd (sdfa)" ows_MetaInfo="9;#" ows__ModerationStatus="0" ows__Level="1" ows_Last_x0020_Modified="9;#2007-10-17 16:06:02" ows_ID="9" ows_owshiddenversion="1" ows_UniqueId="9;#{62782E37-EFF9-4339-B327-0C68E3B833E2}" ows_FSObjType="9;#1" ows_Created_x0020_Date="9;#2007-10-17 16:06:02" ows_ProgId="9;#" ows_FileLeafRef="9;#en-us" ows_FileRef="9;#Style Library/en-us" />
  <z:row ows_LinkFilename="Images" ows_Modified="2007-10-17 16:06:20" ows_Editor="1;#Bsd Hugsds (asdf)" ows_MetaInfo="13;#" ows__ModerationStatus="0" ows__Level="1" ows_Last_x0020_Modified="13;#2007-10-17 16:06:22" ows_ID="13" ows_owshiddenversion="1" ows_UniqueId="13;#{A7F99E97-CF4B-49EC-B78E-1569CEFC454B}" ows_FSObjType="13;#1" ows_Created_x0020_Date="13;#2007-10-17 16:06:21" ows_ProgId="13;#" ows_FileLeafRef="13;#Images" ows_FileRef="13;#Style Library/Images" />
  <z:row ows_LinkFilename="XSL Style Sheets" ows_Modified="2007-10-17 16:06:01" ows_Editor="1;#asdf (asdf)" ows_MetaInfo="1;#" ows__ModerationStatus="0" ows__Level="1" ows_Last_x0020_Modified="1;#2007-10-17 16:06:02" ows_ID="1" ows_owshiddenversion="1" ows_UniqueId="1;#{47F99003-1197-408B-948B-A57A4352EF1D}" ows_FSObjType="1;#1" ows_Created_x0020_Date="1;#2007-10-17 16:06:02" ows_ProgId="1;#" ows_FileLeafRef="1;#XSL Style Sheets" ows_FileRef="1;#Style Library/XSL Style Sheets" />
  <z:row ows_DocIcon="css" ows_LinkFilename="zz1_Black.css" ows_Modified="2007-12-05 13:59:41" ows_Editor="16;#Esdh Stsdr (Exasdl Data sdf)" ows_MetaInfo="54;#vti_parserversion:SR|12.0.0.4518 vti_modifiedby:SR|NOPE\\a-eridss ContentTypeId:SW|0x01010018401F0D02C1F249AFD6103F055C7CA7 vti_author:SR| vti_setuppath:SX|Features\\PublishingLayouts\\Styles\\zz1_Black.css" ows__ModerationStatus="3" ows__Level="2" ows_Last_x0020_Modified="54;#2007-12-05 13:59:42" ows_ID="54" ows_owshiddenversion="3" ows_UniqueId="54;#{744A5639-09F5-4369-9455-4197F75DF54D}" ows_FSObjType="54;#0" ows_Created_x0020_Date="54;#2007-10-17 16:06:22" ows_ProgId="54;#" ows_FileLeafRef="54;#zz1_Black.css" ows_FileRef="54;#Style Library/zz1_Black.css" />
  <z:row ows_DocIcon="css" ows_LinkFilename="zz1_BlackBackground.css" ows_Modified="2007-10-17 16:06:20" ows_Editor="1;#sdf(sdfsdf)" ows_MetaInfo="55;#" ows__ModerationStatus="0" ows__Level="1" ows_Last_x0020_Modified="55;#2007-10-17 16:06:22" ows_ID="55" ows_owshiddenversion="1" ows_UniqueId="55;#{EEB9944F-665D-40BE-AB06-04AA1F818332}" ows_FSObjType="55;#0" ows_Created_x0020_Date="55;#2007-10-17 16:06:22" ows_ProgId="55;#" ows_FileLeafRef="55;#zz1_BlackBackground.css" ows_FileRef="55;#Style Library/zz1_BlackBackground.css" />
  <z:row ows_DocIcon="css" ows_LinkFilename="zz1_Blue.css" ows_Modified="2007-10-17 16:06:20" ows_Editor="1;#sdf(sdf)" ows_MetaInfo="53;#" ows__ModerationStatus="0" ows__Level="1" ows_Last_x0020_Modified="53;#2007-10-17 16:06:22" ows_ID="53" ows_owshiddenversion="1" ows_UniqueId="53;#{834348BE-B9FB-46F6-9B02-8E17AF466064}" ows_FSObjType="53;#0" ows_Created_x0020_Date="53;#2007-10-17 16:06:22" ows_ProgId="53;#" ows_FileLeafRef="53;#zz1_Blue.css" ows_FileRef="53;#Style Library/zz1_Blue.css" />
  <z:row ows_DocIcon="css" ows_LinkFilename="zz1_BlueGlass.css" ows_Modified="2007-10-17 16:06:20" ows_Editor="1;#sdf(asdf)" ows_MetaInfo="56;#" ows__ModerationStatus="0" ows__Level="1" ows_Last_x0020_Modified="56;#2007-10-17 16:06:22" ows_ID="56" ows_owshiddenversion="1" ows_UniqueId="56;#{CE7B7A5C-5BF5-40CE-9D3D-4E0A15066624}" ows_FSObjType="56;#0" ows_Created_x0020_Date="56;#2007-10-17 16:06:22" ows_ProgId="56;#" ows_FileLeafRef="56;#zz1_BlueGlass.css" ows_FileRef="56;#Style Library/zz1_BlueGlass.css" />
  <z:row ows_DocIcon="css" ows_LinkFilename="zz1_Orange.css" ows_Modified="2007-10-17 16:06:20" ows_Editor="1;#sdf (sdf)" ows_MetaInfo="57;#" ows__ModerationStatus="0" ows__Level="1" ows_Last_x0020_Modified="57;#2007-10-17 16:06:22" ows_ID="57" ows_owshiddenversion="1" ows_UniqueId="57;#{6157346C-28C7-4CB9-A53E-4215F7E3F464}" ows_FSObjType="57;#0" ows_Created_x0020_Date="57;#2007-10-17 16:06:22" ows_ProgId="57;#" ows_FileLeafRef="57;#zz1_Orange.css" ows_FileRef="57;#Style Library/zz1_Orange.css" />
  </rs:data>
  </listitems>
  </GetListItemsResult>
  </GetListItemsResponse>
  </soap:Body>
  </soap:Envelope>
 
 
 
Here's Get Web Response
 
  <?xml version="1.0" encoding="utf-8" ?>
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <soap:Body>
- <GetWebResponse xmlns="http://schemas.microsoft.com/sharepoint/soap/">
  <GetWebResult>0</GetWebResult>
- <sWebMetadata>
  <WebID>{5C09D7E5-B383-4395-8465-C16FCFDFD095}</WebID>
  <Title>Home</Title>
  <Description />
  <Author>Name</Author>
  <Language>1033</Language>
  <LastModified>2008-01-17T08:03:03</LastModified>
  <LastModifiedForceRecrawl>0001-01-01T00:00:00</LastModifiedForceRecrawl>
  <ValidSecurityInfo>true</ValidSecurityInfo>
  <InheritedSecurity>false</InheritedSecurity>
  <AllowAnonymousAccess>false</AllowAnonymousAccess>
  <AnonymousViewListItems>true</AnonymousViewListItems>
  <Permissions><Permissions><Permission MemberID="1073741829" Mask="-1" MemberIsUser="False" MemberGlobal="False" RoleName="Full Control" /><Permission MemberID="1073741828" Mask="1012866047" MemberIsUser="False" MemberGlobal="False" RoleName="Design" /><Permission MemberID="1073741925" Mask="2129075183" MemberIsUser="False" MemberGlobal="False" RoleName="Manage Hierarchy" /><Permission MemberID="1073741924" Mask="1011028991" MemberIsUser="False" MemberGlobal="False" RoleName="Approve" /><Permission MemberID="1073741827" Mask="1011028719" MemberIsUser="False" MemberGlobal="False" RoleName="Contribute" /><Permission MemberID="1073741826" Mask="138612833" MemberIsUser="False" MemberGlobal="False" RoleName="Read" /><Permission MemberID="1073741926" Mask="196641" MemberIsUser="False" MemberGlobal="False" RoleName="Restricted Read" /><Permission MemberID="1073741825" Mask="134287360" MemberIsUser="False" MemberGlobal="False" RoleName="Limited Access" /><Permission MemberID="1073741927" Mask="138612801" MemberIsUser="False" MemberGlobal="False" RoleName="View Only" /></Permissions></Permissions>
  <ExternalSecurity>false</ExternalSecurity>
  <IsBucketWeb>false</IsBucketWeb>
  <UsedInAutocat>false</UsedInAutocat>
  </sWebMetadata>
- <vWebs>
- <_sWebWithTime>
  <Url>http://Webapp/Docs</Url>
  <LastModified>2008-01-17T08:03:03</LastModified>
  </_sWebWithTime>
- <_sWebWithTime>
  <Url>http://Webapp/News</Url>
  <LastModified>2008-01-17T08:03:03</LastModified>
  </_sWebWithTime>
- <_sWebWithTime>
  <Url>http://Webapp/Reports</Url>
  <LastModified>2008-01-17T08:03:03</LastModified>
  </_sWebWithTime>
- <_sWebWithTime>
  <Url>http://Webapp/SearchCenter</Url>
  <LastModified>2008-01-17T08:03:03</LastModified>
  </_sWebWithTime>
- <_sWebWithTime>
  <Url>http://Webapp/SiteDirectory</Url>
  <LastModified>2008-01-17T08:03:03</LastModified>
  </_sWebWithTime>
  </vWebs>
Published Thursday, January 31, 2008 11:05 AM by joelo
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Joel Oleson s Blog SharePoint Land Gathering Reporting Data | Hair Growth Products

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker