开发者

How to obtain SPSite for remote server from URL, username and password?

I'm trying to get an SPSite for a remote SharePoint URL:

SPSite site = new SPSite("http://remot开发者_JAVA技巧eserver");

...but I get an exception. The is no problem when i try to connect to sharepoint on the local machine.

I have the required username and password of the remote server. Is there a way to get the SPSite with the username and password?


You cannot do this from a remote machine. You will have to either be running that code on the SharePoint server machine, or interact with the remote server via the SharePoint web services that are exposed.

Can you be more specific about what you want to do with the SPSite once you get it? This may make it easier to make a judgment about which techniques are more appropriate for you.


Since you say you want to interact with lists on this remote site, I suggest you look into the Lists web service that comes with SharePoint 2007 and WSS 3. This SO question is similar, and there's a link to some resources there:

How do I update a sharepoint list using .net?


You'll need to use the OOTB Lists Data Retrieval web service to retrieve list data from a remote machine. The SharePoint object model can only be used on the SharePoint server itself.


As the previous answers said, either you use the sharepoint web services, or you use the code you have and create a custom web service on your sharepoint environment and call it from your external application.


Actually you could connect to a remote site if you have SA on the underlying SQL server. Just use SPFarm.Open(). I'm not saying it is optimal, just making sure it is out there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜