SPListService and remote SharePoint Document Library

Mar 9, 2012 at 12:59 PM

Hi,

I'm first in sharepoint and i don't know if this can work with a remote sharepoint.

This code work on local macchine but don't work if sharepoint library in on different PC.

I tried project library and work good on remote PWA.

Can you helpme ?

 

Thank's. 

 

 var spSessionService = new SPSessionService();           

spSessionService.HostName = "pdell05win7";           

spSessionService.SiteName = "sites/Prova";           

using (new LoginContext("luigi", "password", spSessionService))           

{               

var spListService = new SPListService(spSessionService);               

SPLibraryService sPLibraryService = new SPLibraryService(spListService);               

SPDocumentLibraryInfo c = sPLibraryService.Get("Documenti");               

sPLibraryService.DeleteDocument(spSessionService.SiteUrl + "Documenti/DaFare.xls");

}

Coordinator
Mar 12, 2012 at 12:16 PM

Hi,

 

You need to use the ClientOM services implementation for remote SharePoint instances:

var spListService = new SPClientOMListService(spSessionService); 

var sPLibraryService = new SPClientOMLibraryService(spListService);

 

Hope this helps,

Egor