1

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?

Lamloumi Afif
  • 8,941
  • 26
  • 98
  • 191

1 Answers1

1

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;

}
Vadim Gremyachev
  • 57,952
  • 20
  • 129
  • 193
  • I get as value of `lastModified` = **20140827 14:30:14** which means that the last modification was on 2014 !!! I need the last modification in values not in structure/schema of the list – Lamloumi Afif Dec 29 '16 at 16:01
  • 1
    @LamloumiAfif, are you sure you have specified the proper list name for `GetList` method? In the provided example it returns value from `Pages` list. – Vadim Gremyachev Dec 29 '16 at 16:37
  • I'm not sure but can you plz edit your code to get all the list names with the last dates modification ? – Lamloumi Afif Dec 29 '16 at 16:46