Reputation: 9081
I have an asp.net Web Api application which communicates with a sharepoint application via web services.
I add this method to create a list reference with using http request
public static SPService.Lists CreateSPServiceListsReference(HttpRequestMessage request, bool defaultEpic = true)
{
var login = EpicConfiguration.ExtractAuthenticationParameters(request);
var lists = new SPService.Lists(){
Credentials = new NetworkCredential(login.Username, login.Password, login.Domain),
Url = string.Format(SPServiceListFormat, (defaultEpic)?login.EpicWebUrl:login.RefWebUrl)
};
return lists;
}
The this the first time I have to communicate with a sharepoint app. I need to call a service which takes as a parameter the name of the list and returns the last modification date in this this list. I googled before asking this question but I didn't find a solution.
Any ideas?
Upvotes: 1
Views: 1721
Reputation: 59318
You could utilize Lists.GetList
Method of SharePoint Web Services to retrieve schema for the specified list and then extract Modified
property which represents last modified date.
Example
using (var svc = new ListsService.Lists())
{
svc.Credentials = new NetworkCredential(userName, password, domain);
var list = svc.GetList("Pages");
var listXml = XElement.Parse(list.OuterXml);
var lastModified = listXml.Attribute("Modified").Value;
}
Upvotes: 1