This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Working with lists and list items
Overview
The following operations allow you to carry out sharepoint operations. Click an operation name to see details on how to use it.
For a sample proxy service that illustrates how to carry out file operations, see Sample configuration.
Operation | Description |
---|---|
Create a List. | |
Retrieves all the Lists in the site | |
Retrieves a List by List GUID. | |
getListByTitle | Retrieves a List by List title. |
deleteList | Delete a list. |
retriveListItems | Retrieves all the Lists items in the list. |
createListItem | Create a list item. |
updateList | Update a List. |
getItemById | Retrieves List item with specified ID. |
deleteListItem | Delete a List Item. |
updateListItems | Update a List Item. |
Creates dynamic List Item. |
Operation details
This section provides details on each of the operations.
Create a list
This method allows you to Create a List.
<sharepoint.createList> <type>{$ctx:type}</type> <allowContentTypes>{$ctx:allowContentTypes}</allowContentTypes> <baseTemplate>{$ctx:baseTemplate}</baseTemplate> <contentTypesEnabled>{$ctx:contentTypesEnabled}</contentTypesEnabled> <description>{$ctx:description}</description> <title>{$ctx:title}</title> </sharepoint.createList>
Properties
type
:Type when constructing the metadata variable.allowContentTypes
: Boolean value, that specifies whether the list supports content types.baseTemplates: Specifies list definition type on which the list is based.
-
contentTypesEnabled
: Boolean value, that specifies whether content types are enabled for the list. -
description
: Description of the list. -
title
: The title for the list. Its length must be less than or equal 255 characters.
Sample request
Following is a sample REST request that can be handled by the createList operation.
{ "apiUrl":"https://xxx.sharepoint.com", "type":"SP.List", "allowContentTypes": "true", "baseTemplate": "100", "contentTypesEnabled": "true", "description": "My list description", "title":"BillInfoList", "accessToken":"xxxxxxxxxxxxxxxxxxxxxxxxx", "blocking":"true" }
Retrieve lists
This method allows you to Retrieves all the Lists in the site.
<sharepoint.retriveLists/>
Sample request
Following is a sample REST request that can be handled by the retriveList operation.
{ "apiUrl":"https://xxx.sharepoint.com", "accessToken":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "blocking":"true" }
Get List By ID
This method allows you to retrieves a List by List GUID.
<sharepoint.getListById> <guId>{$ctx:guId}</guId> </sharepoint.getListById>
Properties
guId
: The GUID of the list to return list.
Sample request
Following is a sample REST request that can be handled by the getListById operation.
{ "apiUrl":"https://xxx.sharepoint.com", "guId":"14cf6f8b-5db4-4fb7-af20-07e058b3bcfe", "accessToken":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "blocking":"true" }
Get List By Title
This method allows you to retrieves a List by List title.
<sharepoint.getListByTitle> <title>{$ctx:title}</title> </sharepoint.getListByTitle>
Properties
title
: The title of the list to return.
Sample request
Following is a sample REST request that can be handled by the getListById operation.
{ "apiUrl":"https://xxx.sharepoint.com", "title":"BillInfoList", "accessToken":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "blocking":"true" }
Delete a list
This method allows you to delete a list in site.
<sharepoint.deleteList> <title>{$ctx:title}</title> <ifMatch>{$ctx:ifMatch}</ifMatch> </sharepoint.deleteList>
Properties
title
: Title of the list to delete.ifMatch
: To force an overwrite of the item regardless of version, set the ETag value to "*".
Sample request
Following is a sample REST request that can be handled by the deleteList operation.
{ "apiUrl":"https://xxx.sharepoint.com", "title":"BillInfoList", "ifMatch":"*", "accessToken":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "blocking":"true" }
Retrieves all the Lists items
This method allows you to retrieves all the lists items in the list in the site.
<sharepoint.retriveListItems> <title>{$ctx:title}</title> </sharepoint.retriveListItems>
Properties
title
: The title of the list to return all list items.
Sample request
Following is a sample REST request that can be handled by the retriveListItem operation.
{ "apiUrl":"https://xxx.sharepoint.com", "title":"BillInfoList", "accessToken":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "blocking":"true" }
Create a list item
This method allows you to create a list item.
<sharepoint.createListItem> <title>{$ctx:title}</title> <type>{$ctx:type}</type> <listTitle>{$ctx:listTitle}</listTitle> </sharepoint.createListItem>
Properties
type
: The type of list item to be created (eg:- SP.Data.Team_x0020_tasksListItem)title
: The name of the list item to be created.listTitle
: The title of the list where the item to be created (eg:- Team_x0020_tasks).
Sample request
Following is a sample REST request that can be handled by the createListItem operation.
{ "apiUrl":"https://xxx.sharepoint.com", "type":"SP.Data.BillInfoListListItem", "title": "Item1", "listTitle":"BillInfoList", "accessToken":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "blocking":"true" }
Update a list
This method allows you to update a list in the site.
<sharepoint.updateList> <guId>{$ctx:guId}</guId> <title>{$ctx:title}</title> <type>{$ctx:type}</type> <ifMatch>{$ctx:ifMatch}</ifMatch> </sharepoint.updateList>
Properties
-
guId:
-
type:
Type use when constructing the metadata variable. -
title:
The title of the list to create. ifMatch: To force an overwrite of the item regardless of version, set the ETag value.
Sample request
Following is a sample REST request that can be handled by the updateList operation.
{ "apiUrl":"https://xxx.sharepoint.com", "guId":"14cf6f8b-5db4-4fb7-af20-07e058b3bcfe", "title":"BillInfoListupdated", "type":"SP.List", "ifMatch":"*", "accessToken":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "blocking":"true" }
Get list item by ID
This method allows you to retrieves list item with specified ID.
<sharepoint.getItemById> <title>{$ctx:title}</title> <itemId>{$ctx:itemId}</itemId> </sharepoint.getItemById>
Properties
title
: The title of the list.itemId
: The ID of the list item to return.
Sample request
Following is a sample REST request that can be handled by the getItemById operation.
{ "apiUrl":"https://xxx.sharepoint.com", "title": "BillInfoList", "itemId": "3", "accessToken":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "blocking":"true" }
Delete a list item
This method allows you to delete a list item in site.
<sharepoint.deleteListItem> <title>{$ctx:title}</title> <itemId>{$ctx:itemId}</itemId> <ifMatch>{$ctx:ifMatch}</ifMatch> </sharepoint.deleteListItem>
Properties
title
: Title of the list to delete.-
itemId
: The GUID of the list item. ifMatch
: To force an overwrite of the item regardless of version, set the ETag value to "*".
Sample request
Following is a sample REST request that can be handled by the deleteListItem operation.
{ "apiUrl":"https://xxx.sharepoint.com", "itemId":"2", "title":"BillInfoList", "ifMatch":"*", "accessToken":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "blocking":"true" }
Update a list item
This method allows you to update a list item in the site.
<sharepoint.updateListItems> <title>{$ctx:title}</title> <type>{$ctx:type}</type> <newTitle>{$ctx:newTitle}</newTitle> <itemId>{$ctx:itemId}</itemId> <ifMatch>{$ctx:ifMatch}</ifMatch> </sharepoint.updateListItems>
Properties
-
title:
-
type:
Type use when constructing the metadata variable. -
newTitle:
The new title of item to update. -
itemId
: The ID of the list item to update. ifMatch:
To force an overwrite of the item regardless of version, set the ETag value.
Sample request
Following is a sample REST request that can be handled by the updateListItems operation.
{ "apiUrl":"https://wso.sharepoint.com", "itemId":"3", "title":"BillInfoList", "type":"SP.Data.BillInfoListListItem", "newTitle":"updatedItem1", "ifMatch":"*", "accessToken":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "blocking":"true" }
Create Custom List Item
This method allows you to create custom(dynamic) List Item.
<sharepoint.createCustomListItem> <customListItems>{$ctx:customListItems}</customListItems> <type>{$ctx:type}</type> <listTitle>{$ctx:listTitle}</listTitle> </sharepoint.createCustomListItem>
Properties
listTitle
The title of the custom list.:
-
type:
Type use when constructing the metadata variable. -
customListItems:
The list of items to be created.
Sample request
Following is a sample REST request that can be handled by the createCustomListItem operation.
{ "apiUrl":"https://xxx.sharepoint.com", "type":"SP.Data.Custom002ListItem", "customListItems":{"Title": "Item_005.1", "Add_Col":"john", "mobileNo":"0752676124", "FirstName":"Miller", "LastName":"John", "Address":"Batticalo"}, "listTitle":"Custom002", "blocking":"true", "accessToken":"eyJ0eXAiOixxxxxxxxxxxxx" }
Sample configuration
Following is a sample proxy service that illustrates how to connect to SharePoint with the init operation and use the createList operation. The sample request for this proxy can be found in createList sample request. You can use this sample as a template for using other operations in this category.
<proxy xmlns="http://ws.apache.org/ns/synapse" name="createList" transports="https http" startOnLoad="true" trace="disable"> <description/> <target> <inSequence> <property name="id" expression="json-eval($.id)"/> <property name="clientId" expression="json-eval($.clientId)"/> <property name="clientSecret" expression="json-eval($.clientSecret)"/> <property name="refreshToken" expression="json-eval($.refreshToken)"/> <property name="redirectUri" expression="json-eval($.redirectUri)"/> <property name="resource" expression="json-eval($.resource)"/> <property name="code" expression="json-eval($.code)"/> <property name="apiUrl" expression="json-eval($.apiUrl)"/> <property name="accessToken" expression="json-eval($.accessToken)"/> <property name="type" expression="json-eval($.type)"/> <property name="allowContentTypes" expression="json-eval($.allowContentTypes)"/> <property name="baseTemplate" expression="json-eval($.baseTemplate)"/> <property name="contentTypesEnabled" expression="json-eval($.contentTypesEnabled)"/> <property name="description" expression="json-eval($.description)"/> <property name="title" expression="json-eval($.title)"/> <property name="blocking" expression="json-eval($.blocking)"/> <sharepoint.init> <apiUrl>{$ctx:apiUrl}</apiUrl> <accessToken>{$ctx:accessToken}</accessToken> <id>{$ctx:id}</id> <clientId>{$ctx:clientId}</clientId> <clientSecret>{$ctx:clientSecret}</clientSecret> <refreshToken>{$ctx:refreshToken}</refreshToken> <redirectUri>{$ctx:redirectUri}</redirectUri> <resource>{$ctx:resource}</resource> <registryPath>{$ctx:registryPath}</registryPath> <intervalTime>{$ctx:intervalTime}</intervalTime> <blocking>{$ctx:blocking}</blocking> </sharepoint.init> <sharepoint.createList> <type>{$ctx:type}</type> <allowContentTypes>{$ctx:allowContentTypes}</allowContentTypes> <baseTemplate>{$ctx:baseTemplate}</baseTemplate> <contentTypesEnabled>{$ctx:contentTypesEnabled}</contentTypesEnabled> <description>{$ctx:description}</description> <title>{$ctx:title}</title> </sharepoint.createList> <respond/> </inSequence> <outSequence> <log/> <send/> </outSequence> </target> <parameter name="serviceType">proxy</parameter> </proxy>