Forum Discussion

harshapenikalapati's avatar
harshapenikalapati
Copper Contributor
Feb 03, 2021

How to pass accessToken to getListItems - soap API - SharePoint from Java

We were using the SOAP API's for communicating to SharePoint. The SharePoint was hosted on On-Premises server and evertyhing was working fine. Now the SharePoint is migrated to Cloud. To access the contents we need to pass the access_token. But I am not finding a way to pass the accessToken along with the request.

Our code is written in Java.

Code Snippet -

GetListItemsResponse.GetListItemsResult result = port.getListItems(listName, viewName, query, viewFields, rowLimit, queryOptions, webID);

After getting the ports by parsing the wsdl, we call the getListItems method. The getListItems method implementation is as below.

Could anyone suggest how to pass the accesstoken along with this API call.

Thanks.

/** * * @param listName * @param viewName * @param queryOptions * @param webID * @param query * @param viewFields * @param rowLimit * @return * returns com.microsoft.schemas.sharepoint.lists.GetListItemsResponse.GetListItemsResult */ @WebMethod(operationName = "GetListItems", action = "http://schemas.microsoft.com/sharepoint/soap/GetListItems") @WebResult(name = "GetListItemsResult", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/") @RequestWrapper(localName = "GetListItems", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", className = "com.microsoft.schemas.sharepoint.lists.GetListItems") @ResponseWrapper(localName = "GetListItemsResponse", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/", className = "com.microsoft.schemas.sharepoint.lists.GetListItemsResponse") public com.microsoft.schemas.sharepoint.lists.GetListItemsResponse.GetListItemsResult getListItems( @WebParam(name = "listName", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/") String listName, @WebParam(name = "viewName", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/") String viewName, @WebParam(name = "query", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/") com.microsoft.schemas.sharepoint.lists.GetListItems.Query query, @WebParam(name = "viewFields", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/") com.microsoft.schemas.sharepoint.lists.GetListItems.ViewFields viewFields, @WebParam(name = "rowLimit", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/") String rowLimit, @WebParam(name = "queryOptions", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/") com.microsoft.schemas.sharepoint.lists.GetListItems.QueryOptions queryOptions, @WebParam(name = "webID", targetNamespace = "http://schemas.microsoft.com/sharepoint/soap/") String webID);

Resources