| Register
Thursday, November 20, 2008
SharePoint Forums
SearchForum Home
     
  SharePoint Development  SharePoint Customization  Need to access ...
 Need to access sharepoint site which is at other server through object Model
 
Satish
3 posts
5th
Joined
6/30/2008

Need to access sharepoint site which is at other server through object Model
Posted: 02 Jul 08 8:05 AM

HI, i have 2 servers 150,160 under same domain.

i.e 192.168.0.150, 192.168.0.160 under same domain "ORG11"

In 150 Server Sharepoint has been installed and also vs 2005

In 160 only vs2005 has been installed.

I need to upload a file using sp object model which can be done at 160 server by using following code

string destUrl = Server.UrlPathEncode(http://moss:14499/Shared Documents/satish/NewDocument.txt);

SPWeb site = new SPSite(destUrl).OpenWeb();

site.AllowUnsafeUpdates = true;

Stream fStream = File.Open(@"C:\NewDocument.txt", FileMode.Open);

byte[] contents = new byte[fStream.Length];

fStream.Read(contents, 0, (int)fStream.Length);

site.Files.Add(destUrl, contents);

fStream.Close();

Is it possible to do this. if so, how can i do to upload file in 150 server.

is there any domain restriction for this?

  SharePoint Development  SharePoint Customization  Need to access ...
(c) 2006 SharePoint Forums   |  Privacy Statement  |  Terms Of Use