This SharePoint 2013 tutorial, we will discuss SharePoint web services for SharePoint 2013 or SharePoint 2016, etc. Windows SharePoint Services Web services provide methods that you can use to work remotely with the deployment of Windows SharePoint Services.
Here we will see below SharePoint web service examples:
- SharePoint web service retrieve list items
- SharePoint web service create list item
- SharePoint web service update list item
- SharePoint web service delete list item
- Delete multiple list items in batch using SharePoint web services
- Update List items in batch in SharePoint using web service
- Create a SharePoint group by using SharePoint web service
- Retrieve List Item Version History and Attachment URLs using SharePoint Web Services
- Different profile properties in UserProfileService web service in infopath SharePoint
- Show all subsites list on page in SharePoint Server 2010 using web service
SharePoint Tutorial Contents
- SharePoint 2013 web services
- SharePoint web service retrieve list items
- SharePoint web service create list item
- SharePoint web service update list item
- SharePoint web service delete list item
- Delete multiple list items in batch using SharePoint web services
- Update List items in batch in SharePoint using web service
- Create a SharePoint group by using SharePoint web service
- Retrieve List Item Version History and Attachment URLs using SharePoint Web Services
- Different profile properties in UserProfileService web service in infopath SharePoint
- Show all subsites list on page in SharePoint Server 2010 using web service
The following table lists and describes the available Web services.
All web services are accessible from the SharePoint site context using the following URL:
Web Service | Methods |
Admin Web Service http://<AdminSite>/_vti_adm/Admin.asmxProvides methods for managing a deployment of Microsoft Windows SharePoint Services, such as for creating or deleting site collections. | CreateSite DeleteSite GetLanguages RefreshConfigCache |
Alerts http://<Site>/_vti_bin/Alerts.asmxProvides methods for working with alerts for list items in a SharePoint site. | DeleteAlerts GetAlerts |
Authentication http://<Site>/_vti_bin/Authentication.asmx | Login Mode |
Copy http://<Site>/_vti_bin/Authentication.asmxProvides methods for copying files to or from or within a SharePoint site. | CopyIntoItems CopyIntoItemsLocal GetItem |
Document Workspace http://<Site>/_vti_bin/Dws.asmxExposes methods for managing Document Workspace sites and the data they contain. | CanCreateDwsUrl CreateDws CreateFolder DeleteDws DeleteFolder FindDwsDoc GetDwsData GetDwsMetaData RemoveDwsUser RenameDws UpdateDwsData |
Forms http://<Site>/_vti_bin/Forms.asmxProvides methods for returning forms that are used in the user interface when working with the contents of a list. | GetForm GetFormCollection |
Imaging http://<Site>/_vti_bin/Imaging.asmxProvides methods that enable you to create and manage picture libraries. | CheckSubwebAndList CreateNewFolder Delete Download Edit GetItemsByIds GetItemsXMLData GetListItems ListPictureLibrary Rename Upload |
List Data Retrieval (StsAdapter) http://<Site>/_vti_bin/DspSts.asmxRepresents the adapter service used to perform queries against sites and lists in Microsoft Windows SharePoint Services. | Query |
Lists http://<Site>/_vti_bin/Lists.asmxProvides methods for working with lists and list data. | AddAttachment AddDiscussionBoardItem AddList AddListFromFeature ApplyContentTypeToList CheckInFile CheckOutFile CreateContentType DeleteAttachment DeleteContentType DeleteContentTypeXmlDocument DeleteList GetAttachmentCollection GetList GetListAndView GetListCollection GetListContentType GetListContentTypes GetListItemChanges GetListItemChangesSinceToken GetListItems GetVersionCollection UndoCheckOut UpdateContentType UpdateContentTypesXmlDocument UpdateContentTypeXmlDocument UpdateList UpdateListItems |
Meetings http://<Site>/_vti_bin/Meetings.asmxEnables you to create and manage Meeting Workspace sites. | AddMeeting AddMeetingFromICal CreateWorkspace DeleteWorkspace GetMeetingsInformation GetMeetingWorkspaces RemoveMeeting RestoreMeeting SetAttendeeResponse SetWorkspaceTitle UpdateMeeting UpdateMeetingFromICal |
People http://<Site>/_vti_bin/People.asmx | ResolvePrincipals SearchPrincipals |
Permissions http://<Site>/_vti_bin/Permissions.asmxProvides methods for working with the permissions for a site or list. | AddPermission AddPermissionCollection GetPermissionCollection RemovePermission RemovePermissionCollection UpdatePermission |
Site Data http://<Site>/_vti_bin/SiteData.asmxProvides methods that return metadata or list data from sites or lists in Microsoft Windows SharePoint Services. | EnumerateFolder GetAttachments GetChanges GetContent GetList GetListCollection GetListItems GetSite GetSiteAndWeb GetSiteUrl GetURLSegments GetWeb |
Sites http://<Site>/_vti_bin/Sites.asmxProvides a method for returning information about the collection of site templates on the virtual server. | ExportWeb GetSiteTemplates GetUpdatedFormDigest ImportWeb |
Search http://<Site>/_vti_bin/spsearch.asmxThe QueryService class is the entry point for calling the Search in Microsoft Windows SharePoint Services Query web service. | GetPortalSearchInfo (MOSS only) GetSearchMetadata (MOSS only) Query QueryEx RecordClick (MOSS only) Registration Status |
Users and Groups http://<Site>/_vti_bin/usergroup.asmxProvides methods for working with users, role definitions, and groups. | AddGroup AddGroupToRole AddRole AddRoleDef AddUserCollectionToGroup AddUserCollectionToRole AddUserToGroup AddUserToRole GetAllUserCollectionFromWeb GetGroupCollection GetGroupCollectionFromRole GetGroupCollectionFromSite GetGroupCollectionFromUser GetGroupCollectionFromWeb GetGroupInfo GetRoleCollection GetRoleCollectionFromGroup GetRoleCollectionFromUser GetRoleCollectionFromWeb GetRoleInfo GetRolesAndPermissionsForCurrentUser GetRolesAndPermissionsForSite GetUserCollection GetUserCollectionFromGroup GetUserCollectionFromRole GetUserCollectionFromSite GetUserCollectionFromWeb GetUserInfo GetUserLoginFromEmail RemoveGroup RemoveGroupFromRole RemoveRole RemoveUserCollectionFromGroup RemoveUserCollectionFromRole RemoveUserCollectionFromSite RemoveUserFromGroup RemoveUserFromRole RemoveUserFromSite RemoveUserFromWeb UpdateGroupInfo UpdateRoleDefInfo UpdateRoleInfo UpdateUserInfo |
Versions http://<Site>/_vti_bin/Versions.asmxProvides methods for working with file versions. | DeleteAllVersions DeleteVersion GetVersions RestoreVersion |
Views http://<Site>/_vti_bin/Views.asmxProvides methods for working with views of lists. | AddView DeleteView GetView GetViewCollection GetViewHtml UpdateView UpdateViewHtml UpdateViewHtml2 |
Web Part Pages http://<Site>/_vti_bin/WebPartPages.asmxProvides methods for working with Web Parts. | AddWebPart AddWebPartToZone AssociateWorkflowMarkup ConvertWebPartFormat DeleteWebPart ExecuteProxyUpdates FetchLegalWorkflowActions GetAssemblyMetaData GetBindingResourceData GetCustomControlList GetDataFromDataSourceControl GetFormCapabilityFromDataSourceControl GetSafeAssemblyInfo GetWebPart GetWebPart2 GetWebPartCrossPageCompatibility GetWebPartPage GetWebPartPageConnectionInfo GetWebPartPageDocument GetWebPartProperties GetWebPartProperties2 GetXmlDataFromDataSource RemoveWorkflowAssociation RenderWebPartForEdit SaveWebPart SaveWebPart2 ValidateWorkflowMarkupAndCreateSupportObjects |
Webs http://<Site>/_vti_bin/Webs.asmxProvides methods for working with sites and subsites. | CreateContentType CustomizeCss DeleteContentType GetActivatedFeatures GetAllSubWebCollection GetColumns GetContentType GetContentTypes GetCustomizedPageStatus GetListTemplates GetWeb GetWebCollection RemoveContentTypeXmlDocument RevertAllFileContentStreams RevertCss RevertFileContentStream UpdateColumns UpdateContentType UpdateContentTypeXmlDocument WebUrlFromPageUrl |
Now, let us see how to perform basic create, read, update, and delete (CRUD) operations on SharePoint lists and list items with the SharePoint Web services.
Now, I will demo all the operations on SharePoint list items including retrieve, create, update, and delete list items.
Now, let us see how to retrieve list items using SharePoint web service. Here I have created a button as Retrieve and on click of the button, it will retrieve all the SharePoint list items using SharePoint web service and display it.
Below is the full code to retrieve list items using SharePoint web services and jQuery in SharePoint 2013.
function retriveListItem()
{
var soapEnv = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \
<soapenv:Body> \
<GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \
<listName>companyInfo</listName> \
<viewFields> \
<ViewFields> \
<FieldRef Name='Company' /> \
<FieldRef Name='Industry' /> \
</ViewFields> \
</viewFields> \
</GetListItems> \
</soapenv:Body> \
</soapenv:Envelope>";
$.ajax(
{
url: _spPageContextInfo.webAbsoluteUrl + "/apps/_vti_bin/Lists.asmx",
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=\"utf-8\""
});
}
function processResult(xData, status)
{
var MainResult = "";
$(xData.responseXML).find("z\\:row").each(function()
{
var companyName = $(this).attr("ows_Company");
var Industry = $(this).attr("ows_Industry");
MainResult += MainResult + companyName + "-" + Industry + "\n";
});
$(‘#ResultDiv').text(MainResult);
}
Now, let us see how to create list item using SharePoint web service. Here I have added a create button and on click of the button, the list item will be created in the SharePoint list.
Here, is the full code to create list item using Web Services and jQuery In SharePoint 2013.
function createListItem() {
var batch =
"<Batch OnError=\"Continue\"> \
<Method ID=\"1\" Cmd=\"New\"> \
<Field Name=\"Company\">" + $("#Company").val() + "</Field> \
<Field Name=\"Industry\">" + $("#Industry").val() + "</Field> \
</Method> \
ch>";
var soapEnv =
"<?xml version=\"1.0\" encoding=\"utf-8\"?> \
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> \
<soap:Body> \
<UpdateListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\"> \
<listName>companyInfo</listName> \
<updates> \
" + batch + "</updates> \
</UpdateListItems> \
</soap:Body> \
</soap:Envelope>";
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl+ "/apps/_vti_bin/Lists.asmx",
beforeSend: function(xhr) {
xhr.setRequestHeader("SOAPAction",
"http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
},
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=utf-8"
});
}
function processResult(xData, status) {
retriveListItem();
}
Now, let us see how to update list item using SharePoint web service. Here I have taken an Update and on that button click it will update the SharePoint list item.
Below is the full code to update SharePoint list item using Web Services and jQuery In SharePoint 2013.
function updateListItem() {
var UpdateNewItemXml =
"<Batch OnError=\"Continue\"> \
<Method ID=\"1\" Cmd=\"Update\"> \
<Field Name=\"ID\">7</Field>\
<Field Name=\"Industry\">" + $("#Industry").val() + "</Field> \
</Method> \</Batch>";
var soapEnv =
"<?xml version=\"1.0\" encoding=\"utf-8\"?> \
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> \
<soap:Body> \
<UpdateListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\"> \
<listName>companyInfo</listName> \
<updates> \
" + UpdateNewItemXml + "</updates> \
</UpdateListItems> \
</soap:Body> \
</soap:Envelope>";
$.ajax({
url: _spPageContextInfo.webAbsoluteUrl + "/apps/_vti_bin/Lists.asmx",
beforeSend: function (xhr) {
xhr.setRequestHeader("SOAPAction",
"http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
},
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=utf-8"
});
}
function processResult(xData, status) {
retriveListItem();
}
Now, let us see how to delete SharePoint list item using SharePoint web service. Here I have added a button as Delete and on click of that, it will delete the SharePoint list item using web service.
Below is the full code to delete SharePoint list item using Web Services and jQuery In SharePoint 2013.
function deleteListItem()
{
var DeleteItemXml = "<Batch OnError=\"Continue\"> \
<Method ID=\"1\" Cmd=\"Delete\"> \
<Field Name=\"ID\">7</Field>\
<Field Name=\"Company\">" + $("#Company").val() + "</Field> \
</Method> \</Batch>";
var soapEnv = "<?xml version=\"1.0\" encoding=\"utf-8\"?> \
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> \
<soap:Body> \
<UpdateListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\"> \
<listName>companyInfo</listName> \
<updates> \
" + DeleteItemXml + "</updates> \
</UpdateListItems> \
</soap:Body> \
</soap:Envelope>";
$.ajax(
{
url: _spPageContextInfo.webAbsoluteUrl + "/apps/_vti_bin/Lists.asmx",
beforeSend: function(xhr)
{
xhr.setRequestHeader("SOAPAction", "http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");
},
type: "POST",
dataType: "xml",
data: soapEnv,
complete: processResult,
contentType: "text/xml; charset=utf-8"
});
}
function processResult(xData, status)
{
retriveListItem();
}
This is how we can display, create, update, and delete SharePoint list items using SharePoint web service.
Now, we will discuss how to delete multiple items in batch using SharePoint 2013 default services. I have to delete multiple documents/items we can use REST api but we have to make ‘n’ number of calls to delete ‘n’ number of Rows. The major performance hit I believe.
Here we can easily use SharePoint default Lists.asmx Service to delete multiple rows.
We all have been using REST api to do different types of CRUD operations but there is also another way to do the CRUD operations. All we need is to use SharePoint default Services like:
- Copy.asmx
- Lists.asmx
- Versions.asmx
- UserGroup.asmx
- Permissions.asmx
- Views.asmx and many more.
Why to use ?
- It is already prewritten and all we have to do is just consume it .
- No overhead of service deployment .
- Easily you can perform BATCH operations .
if(location.href.indexOf("TestPage-for-Batch-Operations.aspx")>-1) {
$(document).ready(function () {
$("#testBatch").click(function(){
delete(siteurl);
});
});
}
function delete(siteurl) {
//let say I want to delete item Ids 465 , 466 and 486
var obj=[];
obj.push(465);
obj.push(466);
obj.push(486);
var fields = "";
//framing the Rows to be deleted .Here I have deleted w.r.t ID but it can be any column name
for(var i=0;i<obj.length;i++){
fields += "<Method ID=\""+obj[i]+"\" Cmd=\"Delete\"><Field Name=\"ID\">" + obj[i]+ "</Field></Method>";
}
var batch = "<Batch OnError=\"Continue\">" + fields + "</Batch>";
var soapEnv = BuildSoapEnv(batch, ‘Master Document Transmittals’);
DeleteBatchItems(soapEnv, onSuccessDelete,siteurl);
}
//Bulid SOAP Envelope having the full request
function BuildSoapEnv(batch, listname)
{
var soapEnv =
"<?xml version=\"1.0\" encoding=\"utf-8\"?> \
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> \
<soap:Body> \
<UpdateListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\"> \
<listName>" + listname + "</listName> \
<updates> \
" + batch + "</updates> \
</UpdateListItems> \
</soap:Body> \
</soap:Envelope>";
return soapEnv;
}
//Perform Delete operation in a Batch
function DeleteBatchItems(soapEnv, functionToCall,siteurl)
{
$.ajax({
url: siteurl+ "/_vti_bin/Lists.asmx",
beforeSend: function(xhr) {
//to avoid security validation error SOAPAction header must be provided
xhr.setRequestHeader("SOAPAction","http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");},
type: "POST",
dataType: "xml",
crossdomain:true,
data: soapEnv,
complete: functionToCall,
contentType: "text/xml; charset=\"utf-8\""
});
}
function onSuccessDelete()
{
// do something
}
Now, we will see how to update list items in bach using the SharePoint web service.
function BatchUpdate(obj,listname,siteurl) {
var fields = "";
//here Obj has 2 properties Id and Position and batch Update is done i.e according to id positions are updated in list
for(var i=0;i<obj.length;i++){
fields += "<Method ID=\""+obj[i].Id+"\" Cmd=\"Update\"><Field Name=\"ID\">" + obj[i].Id+ "</Field><Field Name=\"Position\">" + obj[i].Position+ "</Field></Method>";
}
var batch = "<Batch OnError=\"Continue\">" + fields + "</Batch>";
var soapEnv = BuildSoapEnv(batch,listname);
UpdateBatchItems(soapEnv, onSuccessUpdate,siteurl);
}
function BuildSoapEnv(batch, listname)
{
var soapEnv =
"<?xml version=\"1.0\" encoding=\"utf-8\"?> \
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"> \
<soap:Body> \
<UpdateListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\"> \
<listName>" + listname+ "</listName> \
<updates> \
" + batch + "</updates> \
</UpdateListItems> \
</soap:Body> \
</soap:Envelope>";
return soapEnv;
}
function UpdateBatchItems(soapEnv, functionToCall,siteurl)
{
$.ajax({
url: siteurl+ "/_vti_bin/Lists.asmx",
beforeSend: function(xhr) {
xhr.setRequestHeader("SOAPAction","http://schemas.microsoft.com/sharepoint/soap/UpdateListItems");},
type: "POST",
dataType: "xml",
crossdomain:true,
data: soapEnv,
complete: functionToCall,
contentType: "text/xml; charset=\"utf-8\""
});
}
function onSuccessUpdate()
{
alert("Success");
}
Now, we will see how to create a SharePoint security group by using the SharePoint 2010 web service.
To work with the SharePoint web service we need to give the web service reference into the SharePoint solution. To add a group we need to give reference to the UserGroup.asmx web service.
Here we give the reference like below:
http://<Site URL>/_vti_bin/UserGroup.asmx
Example: http://bsahoo3:18649/_vti_bin/UserGroup.asmx
Once we give reference we can use the AddGroup method to add a group to SharePoint.
Here the AddGroup method takes 5 parameters like below:
Below is the full code to create a SharePoint Security group by using SharePoint web service
public void AddGroup(string groupName, string ownerIdentifier, string ownerType, string defaultUserLoginName, string description)
try
{
UserGroup userGroup = new UserGroup();
userGroup.Url = "http://bsahoo3:18649/_vti_bin/UserGroup.asmx";
userGroup.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;
userGroup.AddGroup("TestGroup", "ASIAPACIFIC\\SAHOOBIJ", "user", "ASIAPACIFIC\\SAHOOBIJ", "Test group created from code.");
}
catch (Exception ex)
{
}
Once you will execute the code, the group will appear like below:
This SharePoint tutorial we will discuss how to retrieve SharePoint list item version history and attachment URL using SharePoint web services. Here, I will show how to do it using client-side object model code via SharePoint Web service using Webservice only ( _vit_bin/lists.asmx).
The scenario is best suited while doing migration from one SharePoint version to another, we need to maintain the attachment URL and the versioning of the fields using Webservice only ( _vit_bin/lists.asmx).
Below is the CSOM code to retrieve SharePoint list item version history and attachment URL using SharePoint 2013 web services.
public static void getListData(string weburl)
{
Lists.Lists myservice = new Lists.Lists();
myservice.Credentials = System.Net.CredentialCache.DefaultCredentials;
myservice.Url = weburl + "/_vti_bin/Lists.asmx";
try
{
/* Assign values to pass the GetListItems method*/
string listName = "Test List";
string viewName = "";
string rowLimit = "100";
// Instantiate an XmlDocument object
System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement query = xmlDoc.CreateElement("Query");
System.Xml.XmlElement viewFields = xmlDoc.CreateElement("ViewFields");
System.Xml.XmlElement queryOptions = xmlDoc.CreateElement("QueryOptions");
/*Use CAML query*/
query.InnerXml = string.Format("<Where><And>" +
"<Gt>" +
"<FieldRef Name=’ID’ /><Value Type=’Counter’>{0}</Value>" +
"</Gt>" +
"<Leq><FieldRef Name=’ID’ /><Value Type=’Counter’>{1}</Value></Leq>" +
"</And></Where>", 0, 100);
viewFields.InnerXml = "<FieldRef Name=’Title’ />" +
"<FieldRef Name=’Created’ />" +
"<FieldRef Name=’Modified’ />" +
"<FieldRef Name=’Author’ />" +
"<FieldRef Name=’Editor’ />";
queryOptions.InnerXml = "";
System.Xml.XmlNode nodeListItems = myservice.GetListItems(listName, viewName, query, viewFields, rowLimit, null, null);
XmlDataDocument xmlDocResult = new XmlDataDocument();
xmlDocResult.LoadXml(nodeListItems.InnerXml);
XmlNodeList rows = xmlDocResult.GetElementsByTagName("z:row");
foreach(XmlNode attribute in rows) {
Console.WriteLine(attribute.Attributes["ows_Title"].Value);
string AttachmentUrl = GetAttachmentUrls(weburl, listName, attribute.Attributes["ows_ID"].Value, "");
string vesrsion = GetVersions(weburl, listName, attribute.Attributes["ows_ID"].Value, "Title");
}
} catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
public static string GetAttachmentUrls(string siteUrl, string listId, string itemId, string fieldName)
{
StringBuilder sb = new StringBuilder();
Lists.Lists listService = new Lists.Lists();
listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
listService.Url = siteUrl + "/_vti_bin/lists.asmx";#
region Get the list of attachments
XmlNode nodeAttachments = listService.GetAttachmentCollection(listId, itemId);
List < string > values = new List < string > ();
foreach(System.Xml.XmlNode xNode in nodeAttachments)
{
values.Add(xNode.InnerText);
}
return string.Join(";", values.ToArray());#
endregion
}
public static string GetVersions(string siteUrl, string listId, string itemId, string fieldName)
{
StringBuilder sb = new StringBuilder();
Lists.Lists listService = new Lists.Lists();
listService.Credentials = System.Net.CredentialCache.DefaultCredentials;
listService.Url = siteUrl + "/_vti_bin/lists.asmx";
#region Get version histories
if (!string.IsNullOrEmpty(fieldName))
{
XmlNode nodeVersions = listService.GetVersionCollection(listId, itemId, fieldName);
foreach(System.Xml.XmlNode xNode in nodeVersions)
{
string dateHistory = xNode.Attributes["Modified"].Value;
dateHistory = FormatDateFromSP(dateHistory);
string commentHistory = xNode.Attributes[fieldName].Value;
string editor = GetEditor(xNode.Attributes["Editor"].Value);
sb.Append(editor + " (" + dateHistory + ") " + commentHistory + "\n\n");
}
}
return sb.ToString();#
endregion
}
private static string FormatDateFromSP(string dateHistory)
{
string result;
result = dateHistory.Replace("T", " ");
result = result.Replace("Z", "");
return result;
}
/// <summary>
/// The XmlNode for version on the Editor contains the Editor Name
/// </summary>
/// <param name="ienumEditor"></param>
/// <returns></returns>
private static string GetEditor(string nodeValue)
{
string[] arr;
char[] sep =
{
‘#’
};
// Go for the Editor attribute value
// A sample is: 30;#Jo�o Faneca,#VIATECLA\\jfaneca,#[email protected],#[email protected],#Jo�o Faneca
arr = nodeValue.Split(sep);
// Grab the second element for the array
nodeValue = arr[1];
// Remove the last comma from the Editor value
return nodeValue.Remove(nodeValue.Length – 1);
}
}
Here, we learned how to retrieve the SharePoint list version history and attachment URLs programmatically using client-side object model (csom) code in SharePoint 2013/2016/2010.
Now, we will discuss what are the different profile properties we can get from the UserProfileService.asmx web service.
You can get user’s information by creating a data connection with web service. We need the below web service.
http://ServerName/_vti_bin/UserProfileService.asmx
Below is the complete list of profile details to get returned by userProfileByName data connection.
- UserProfile_GUID
- AccountName
- FirstName
- LastName
- PreferredName
- WorkPhone
- Office
- Department
- Title
- Manager
- AboutMe
- PersonalSpace
- PictureURL
- UserName
- QuickLinks
- WebSite
- PublicSiteRedirect
- SPS-Dotted-line
- SPS-Peers
- SPS-Responsibility
- SPS-Skills
- SPS-PastProjects
- SPS-Interests
- SPS-School
- SPS-SipAddress
- SPS-Birthday
- SPS-MySiteUpgrade
- SPS-DontSuggestList
- SPS-ProxyAddresses
- SPS-HireDate
- SPS-LastColleagueAdded
- SPS-OWAUrl
- SPS-ResourceAccountName
- SPS-MasterAccountName
- Assistant
- WorkEmail
- CellPhone
- Fax
- HomePhone
Here we saw what are the different profile properties in UserProfileService web service in InfoPath 2010 in SharePoint 2010.
Now, we will see how to show all subsites list on a page using SharePoint web service.
Open the site in SharePoint Designer 2010. Go to the Data Sources on Ribbon and click on the SOAP Service Connection. See in fig
Add the link to your site in the field “Service description location” and add the part :
_vti_bin/Webs.asmx?WSDL this will give you a link like this
http://sitecollectionurl/sites/yoursites/_vti_bin/Webs.asmx?WSDL
Now click on the “Connect now” button: SPD automatically adds the select statement, the WebSoap port, and GetWebCollection. See in fig
Click OK. Now you go to the page where you want to add the list in SharePoint designer. On the Insert tab, add a Data view of the SOAP service connection. See in fig
Now you save the page and open it in your browser, you will see a list of subsites. See in fig
You may like following SharePoint site tutorials:
- How to send data through SoapHeader in webservices in Asp.net?
- Azure Cognitive Services
- Display tfs work items in GridView using SharePoint Visual Web Part
- Delete Hidden Web Application in SharePoint 2013 using PowerShell
Here, we learned what are various URLs to access SharePoint web services. Also, we saw below SharePoint web service examples:
- SharePoint web service retrieve list items
- SharePoint web service create list item
- SharePoint web service update list item
- SharePoint web service delete list item
- Delete multiple list items in batch using SharePoint web services
- Update List items in batch in SharePoint using web service
- Create a SharePoint group by using SharePoint web service
- Retrieve List Item Version History and Attachment URLs using SharePoint Web Services
- Different profile properties in UserProfileService web service in infopath SharePoint
- Show all subsites list on page in SharePoint Server 2010 using web service
I am Developer working on Microsoft Technologies for the past 6+years. I am very much passionate about programming and my core skills are SharePoint, ASP.NET & C#,Jquery,Javascript,REST. I am running this blog to share my experience & learning with the community I am an MCP, MCTS .NET & Sharepoint 2010, MCPD Sharepoint 2010, and MCSD HTML 5,Sharepoint 2013 Core
Solutions. I am currently working on Sharepoint 2010, MOSS 2007, Sharepoint 2013,Sharepoint 2013 App Dev, C#, ASP.NET, and SQL Server 2008.