Class SPClient
- java.lang.Object
-
- com.avoka.component.sharepoint.SPClient
-
public class SPClient extends Object
Provides a Microsoft SharePoint Client class with web service factory methods.SharePoint Client Example
The Groovy script example below illustrates using the
SPClientobject to create anListSharePoint web service object, which is then user to lookup a list collection. In this examples configuration Service Parameters are accessed via theparamsmap object.import com.avoka.component.sharepoint.SPClient import com.avoka.component.sharepoint.service.List // Create a SharePoint client using the service params map with the configured connection details def spClient = new SPClient(params.username, params.password, params.url, params.domain) // Create a List web service def listService = spClient.getLists() // Get a List collection map def collectionMap = listService.getListCollection(params.siteContext)
A
SPClientcan also be created by passing it a Map of connection parameters. This is typically used when the SharePoint server connection details are configured as Service Parameters. The service parameters must include:username- the SharePoint server login usernamepassword- the SharePoint server login passwordurl- the SharePoint server URLdomain- the SharePoint server Domain
SPClientbeing created with a Map of Service parameters is provided below:// Provides a Groovy script based submission delivery process. // // Script parameters include: // submission : com.avoka.fc.core.entity.Submission // submissionXml : String // receiptPDF : byte[] // attachmentsMap : Map
// deliveryCheckpoint : com.avoka.fc.core.service.submission.DeliveryCheckpointService // serviceDefinition : com.avoka.fc.core.entity.ServiceDefinition // serviceParameters : Map import com.avoka.component.sharepoint.SPClient import com.avoka.component.sharepoint.service.Copy // Create a SharePoint client using the service params map with the configured connection details def spClient = new SPClient(serviceParameters) // Create a Copy web service def copyService = spClient.getCopy() // Copy the PDF receipt to location def path = "http://test-sharepoint/form/" + submission.receiptNumber + ".pdf" def displayName = submission.formName + " " + submission.receiptNumber def internalName = displayName def sourcePath = "http://null" copyService.copyIntoItems(path, displayName, internalName, sourcePath, receiptPDF) - Since:
- 3.5.0
-
-
Constructor Summary
Constructors Constructor Description SPClient(String username, String password, String serverUrl, String serverDomain)Instantiate a SharePoint client with the provided connection details.SPClient(Map<String,String> serviceParameters)Instantiate a SharePoint client with the provided connection details map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CopygetCopy()Return a Copy SharePoint web service.ListsgetLists()Return a Lists SharePoint web service.UserGroupgetUserGroup()Return a UserGroup SharePoint web service.UserProfileServicegetUserProfileService()Return a UserProfileService SharePoint web service.WebsgetWebs()Return a Webs SharePoint web service.
-
-
-
Constructor Detail
-
SPClient
public SPClient(String username, String password, String serverUrl, String serverDomain) throws SPException
Instantiate a SharePoint client with the provided connection details.- Parameters:
username- SharePoint login usernamepassword- SharePoint login passswordserverUrl- SharePoint server URLserverDomain- SharePoint server domain- Throws:
SPException- in case of SharePoint error response during authentication
-
SPClient
public SPClient(Map<String,String> serviceParameters) throws SPException
Instantiate a SharePoint client with the provided connection details map.The
serviceParameterconstructor argument must contain the following key values:username- the SharePoint server login usernamepassword- the SharePoint server login passwordurl- the SharePoint server URLdomain- the SharePoint server Domain
- Parameters:
serviceParameters- the containing the SharePoint server connection details with the names:[ "username", "password", "url", "domain" ].- Throws:
SPException- in case of SharePoint error response during authentication
-
-
Method Detail
-
getCopy
public Copy getCopy()
Return a Copy SharePoint web service.Groovy Example
The Groovy script example below illustrates using the
SPClientobject to create anCopySharePoint web service object. In this examples configuration Service Parameters are accessed via theparamsmap object.import com.avoka.component.sharepoint.SPClient import com.avoka.component.sharepoint.service.Copy // Create a SharePoint client using the service params map with the configured connection details def spClient = new SPClient(params.username, params.password, params.url, params.domain) // Create a Copy web service def copyService = spClient.getCopy() // Get an item byte array def itemData = copyService.getItem(params.path)
- Returns:
- a Copy SharePoint web service.
-
getLists
public Lists getLists()
Return a Lists SharePoint web service.Groovy Example
The Groovy script example below illustrates using the
SPClientobject to create anListSharePoint web service object. In this examples configuration Service Parameters are accessed via theparamsmap object.import com.avoka.component.sharepoint.SPClient import com.avoka.component.sharepoint.service.Lists // Create a SharePoint client using the service params map with the configured connection details def spClient = new SPClient(params.username, params.password, params.url, params.domain) // Create a List web service def listService = spClient.getLists() // Get a List collection map def collectionMap = listService.getListCollection(params.siteContext)
- Returns:
- a Lists SharePoint web service.
-
getUserGroup
public UserGroup getUserGroup()
Return a UserGroup SharePoint web service.Groovy Example
The Groovy script example below illustrates using the
SPClientobject to create anUserGroupSharePoint web service object. In this examples configuration Service Parameters are accessed via theparamsmap object.import com.avoka.component.sharepoint.SPClient import com.avoka.component.sharepoint.service.UserGroup // Create a SharePoint client using the service params map with the configured connection details def spClient = new SPClient(params.username, params.password, params.url, params.domain) // Create a UserGroup web service def userGroupService = spClient.getUserGroup() // Get a User object for the given username def user = userGroupService.getUserInfo(username)
- Returns:
- a UserGroup SharePoint web service.
-
getUserProfileService
public UserProfileService getUserProfileService()
Return a UserProfileService SharePoint web service.Groovy Example
The Groovy script example below illustrates using the
SPClientobject to create anUserProfileServiceSharePoint web service object. In this examples configuration Service Parameters are accessed via theparamsmap object.import com.avoka.component.sharepoint.SPClient import com.avoka.component.sharepoint.service.UserProfileService // Create a SharePoint client using the service params map with the configured connection details def spClient = new SPClient(params.username, params.password, params.url, params.domain) // Create a UserProfileService web service def userProfileServiceService = spClient.getUserProfileService() // Get a user profile property data object for the given account name def propertyData = userProfileServiceService.getUserProfileByName(accountname)
- Returns:
- UserProfileService SharePoint web service.
-
getWebs
public Webs getWebs()
Return a Webs SharePoint web service.Groovy Example
The Groovy script example below illustrates using the
SPClientobject to create anWebsSharePoint web service object. In this examples configuration Service Parameters are accessed via theparamsmap object.import com.avoka.component.sharepoint.SPClient import com.avoka.component.sharepoint.service.Webs // Create a SharePoint client using the service params map with the configured connection details def spClient = new SPClient(params.username, params.password, params.url, params.domain) // Create a Webs web service def websService = spClient.getWebs() // Get a web object for the given url def web = websService.getWeb(url)
- Returns:
- Webs SharePoint web service.
-
-