Class SPClient
SharePoint Client Example
The Groovy script example below illustrates using the SPClient
object to create an List
SharePoint web service
object, which is then user to lookup a list collection. In this examples configuration Service Parameters are accessed via the
params
map 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 SPClient
can 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
SPClient
being 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<String, com.avoka.fc.form.service.DataDocument> // deliveryCheckpoint : com.avoka.fc.core.service.submission.DeliveryCheckpointService // serviceDefinition : com.avoka.fc.core.entity.ServiceDefinition // serviceParameters : Map<String, String> 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
-
Method Summary
-
Constructor Details
-
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
Instantiate a SharePoint client with the provided connection details map.The
serviceParameter
constructor 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 Details
-
getCopy
Return a Copy SharePoint web service.Groovy Example
The Groovy script example below illustrates using the
SPClient
object to create anCopy
SharePoint web service object. In this examples configuration Service Parameters are accessed via theparams
map 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
Return a Lists SharePoint web service.Groovy Example
The Groovy script example below illustrates using the
SPClient
object to create anList
SharePoint web service object. In this examples configuration Service Parameters are accessed via theparams
map 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
Return a UserGroup SharePoint web service.Groovy Example
The Groovy script example below illustrates using the
SPClient
object to create anUserGroup
SharePoint web service object. In this examples configuration Service Parameters are accessed via theparams
map 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
Return a UserProfileService SharePoint web service.Groovy Example
The Groovy script example below illustrates using the
SPClient
object to create anUserProfileService
SharePoint web service object. In this examples configuration Service Parameters are accessed via theparams
map 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
Return a Webs SharePoint web service.Groovy Example
The Groovy script example below illustrates using the
SPClient
object to create anWebs
SharePoint web service object. In this examples configuration Service Parameters are accessed via theparams
map 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.
-