你可以把webservice部署在wss的机子上,然后公开方法与网络内其他的机子交互 或者你可以使用自带的webservice与服务器的list交互 see wss3.0 sdk webservice how to /*Declare and initialize a variable for the Lists Web service.*/ Web_Reference.Lists myservice = new Web_Reference.Lists();/*Authenticate the current user by passing their default credentials to the Web service from the system credential cache. */ myservice.Credentials = System.Net.CredentialCache.DefaultCredentials;/*Set the Url property of the service for the path to a subsite. Not setting this property will return the lists in the root Web site.*/ listService.Url = "http://Server_Name/Subsite_Name/_vti_bin/Lists.asmx";/*Declare an XmlNode object and initialize it with the XML response from the GetListCollection method. */ System.Xml.XmlNode node = myservice.GetListCollection();/*Loop through XML response and parse out the value of the Title attribute for each list. */ foreach(System.Xml.XmlNode xmlnode in node) { label1.Text+=xmlnode.Attributes["Title"].Value + "\n"; }
see wss sdk webservice guidelines webservice的应用格式为: http://MyServer/[sites/][MySite/][MySubsite/]_vti_bin/Web_Service.asmx 请针对子站url设置代理类的引用
using (SPSite siteCollection = SPContext.Current.Site)
{
SPList list = siteCollection.AllWebs["Site_Name"].Lists["List_Name"]; SPQuery query = new SPQuery();
query.Query = "<Where><Gt><FieldRef Name='ProjectedValue'/>" +
"<Value Type='Number'>500</Value></Gt></Where>";
SPListItemCollection listItems = list.GetItems(query); foreach (SPListItem listItem in listItems)
{
Label1.Text += "Item: " + SPEncode.HtmlEncode(listItem["Title"].ToString()) +
"::" + "Value: " + SPEncode.HtmlEncode(listItem["Investment"].ToString()) +
"::" + "Calculated: " +
SPEncode.HtmlEncode(listItem["ProjectedValue"].ToString()) + "<BR>";
}
}
这个方法必须要程序在服务器本地运行.没法部署到别处.
有用lists这个webservice的吗?
或者你可以使用自带的webservice与服务器的list交互
see wss3.0 sdk webservice how to
/*Declare and initialize a variable for the Lists Web service.*/
Web_Reference.Lists myservice = new Web_Reference.Lists();/*Authenticate the current user by passing their default
credentials to the Web service from the system credential
cache. */
myservice.Credentials =
System.Net.CredentialCache.DefaultCredentials;/*Set the Url property of the service for the path to a subsite. Not setting this property will return the lists in the root Web site.*/
listService.Url =
"http://Server_Name/Subsite_Name/_vti_bin/Lists.asmx";/*Declare an XmlNode object and initialize it with the XML
response from the GetListCollection method. */
System.Xml.XmlNode node = myservice.GetListCollection();/*Loop through XML response and parse out the value of the
Title attribute for each list. */
foreach(System.Xml.XmlNode xmlnode in node)
{
label1.Text+=xmlnode.Attributes["Title"].Value + "\n";
}
webservice的应用格式为:
http://MyServer/[sites/][MySite/][MySubsite/]_vti_bin/Web_Service.asmx
请针对子站url设置代理类的引用