java.lang.Object
com.avoka.component.sharepoint.AbstractService
com.avoka.component.sharepoint.service.Webs

public class Webs extends AbstractService
Provides Webs SharePoint web service class.

Webs SharePoint Example

The Groovy script example below illustrates using the Webs service to get a Web object. In this example an absolute web URL parameter is specified by the webUrl String object.

 import com.avoka.component.sharepoint.SPClient
 import com.avoka.component.sharepoint.service.Webs
 import com.avoka.component.sharepoint.type.Web

 // Create a SharePoint client using the service parameters map with the configured connection details
 def spClient = new SPClient(serviceParameters)

 // Create a Webs web service
 def websService = spClient.getWebs()

 // Get a web object for the given url
 def web = websService.getWeb(url)

 // Get web properties ..
 def title = web.getTitle()
 def url = web.getUrl() 
Since:
3.5.0
  • Constructor Details

    • Webs

      public Webs(SPConnection sharePointConnection)
      Instantiate the Webs Interface wrapper with SharePoint Connection context
      Parameters:
      sharePointConnection - SharePoint connection context
  • Method Details

    • getServiceName

      public String getServiceName()
      Return the web service name.
      Specified by:
      getServiceName in class AbstractService
      Returns:
      the web service name
    • getWeb

      public Web getWeb(String webUrl) throws SPException
      Return a Site's Properties.

      Groovy Example

      The Groovy script example below illustrates using the Webs service to get a Web object. In this example an absolute web URL parameter is specified by the webUrl String object.

       import com.avoka.component.sharepoint.SPClient
       import com.avoka.component.sharepoint.service.Webs
       import com.avoka.component.sharepoint.type.Web
      
       // Create a SharePoint client using the service parameters map with the configured connection details
       def spClient = new SPClient(serviceParameters)
      
       // Create a Webs web service
       def websService = spClient.getWebs()
      
       // Get a web object for the given url
       def web = websService.getWeb(url)
      
       // Get web properties ..
       def webTitle = web.getTitle()
       def webUrl = web.getUrl() 

      Web Service Method

      The Microsoft SharePoint Web Service SOAP Method:

      http://schemas.microsoft.com/sharepoint/soap/GetWeb

      http://msdn.microsoft.com/en-us/library/webs.webs.getweb.aspx

       

      Parameters:
      webUrl - Absolute URL of the Site, or a period (".") to return information about the current site.
      Returns:
      Web object representing the Site's properties.
      Throws:
      SPException - in case of SharePoint error response
    • getWebCollection

      public Map<String,String> getWebCollection(String siteContext) throws SPException
      Retrieve the Title and URL's of all Sites beneath the specified Site.

      Groovy Example

      The Groovy script example below illustrates using the Webs service to get a Collection of Web Titles and URls. In this example an optional site context parameter is specified by the siteContext String object.

       import com.avoka.component.sharepoint.SPClient
       import com.avoka.component.sharepoint.service.Webs
      
       // Create a SharePoint client using the service parameters map with the configured connection details
       def spClient = new SPClient(serviceParameters)
      
       // Create a Webs web service
       def websService = spClient.getWebs()
      
       // Get map of web titles and urls
       def webCollection = websService.getWebCollection(siteContext)
      
       // Iterate through Sites
       Iterator webKeyIter = webCollection.keySet().iterator()
       while (webKeyIter.hasNext()) {
           def webTitle = (String) webKeyIter.next()
           def webUrl = webCollection.get(webTitle)
       } 

      Web Service Method

      The Microsoft SharePoint Web Service SOAP Method:

      http://schemas.microsoft.com/sharepoint/soap/GetWebCollection

      http://msdn.microsoft.com/en-us/library/webs.webs.getweb.aspx

       

      Parameters:
      siteContext - (Optional) Provide SharePoint Site context if accessing a non-default site.
      Returns:
      Map<String,String> representing the <Title, URL> of each Site belonging to the specified Site.
      Throws:
      SPException - in case of SharePoint error response