本文介绍了项目服务器的风险列表在Silverlight中不使用客户端对象模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我正在尝试获取"风险"的所有字段。 Project Server列表,可以在Silverlight webpart的下拉框中显示。我正在使用Microsoft SharePoint ClientContext。我收到异常" 输入字符串的格式不正确。"  在Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)   在Microsoft.SharePoint.Client.ClientRequest.ProcessResponse(HttpWebResponse回复)   在Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryGetResponseAsyncCallback(IAsyncResult asyncResult)I am trying to fetch all the field of "Risks" List of Project Server which can be displayed in dropdown box in Silverlight webpart. I am using Microsoft SharePoint ClientContext. I am getting an exception "Input string was not in a correct format."   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream)   at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse(HttpWebResponse response)   at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryGetResponseAsyncCallback(IAsyncResult asyncResult)下面是代码片段 ClientContextClientContext   currentContext = new ClientContext ( "服务器网址" );currentContext =newClientContext("Server Url");   Web myWeb = currentContext.Web;WebmyWeb = currentContext.Web;   网站 site = currentContext.Site;Sitesite = currentContext.Site;   列表 myList = myWeb.Lists.GetByTitle( " Risks" );ListmyList = myWeb.Lists.GetByTitle("Risks");  myField = myList.Fields;myField = myList.Fields; currentContext.Load(site);currentContext.Load(site); currentContext.Load(myWeb);currentContext.Load(myWeb); currentContext.Load (myList);currentContext.Load(myList); currentContext.Load(myField);currentContext.Load(myField); currentContext.ExecuteQueryAsync(getRequestSucceeded,getRequestFailure);currentContext.ExecuteQueryAsync(getRequestSucceeded, getRequestFailure); private   void getRequestSucceeded( object 发件人, ClientRequestSucceededEventArgs e)voidgetRequestSucceeded(objectsender,ClientRequestSucceededEventArgse) {   MessageBox 。显示( " ;成功" );MessageBox.Show("Success");}   private void getRequestFailure( object 发件人, ClientRequestFailedEventArgs e)privatevoidgetRequestFailure(objectsender,ClientRequestFailedEventArgse) {   MessageBox 。显示( " ;失败" );MessageBox.Show("Failure");}我试图按列表ID访问列表但是相同结果I tried to access the List by List Id but the same result推荐答案 我无法解释您在此处看到的问题;我可以通过风险列表确认这一点。标准的sharepoint列表工作正常。I can't explain the problem you are seeing here; I can confirm this with the risk list. Standard sharepoint lists work just fine.解决此问题的一种方法是使用Microsoft.SharePoint类:One way to go around this problem is using Microsoft.SharePoint classes instead: SPSite site = new SPSite(siteUrl); SPWeb web = site.OpenWeb(); SPList riskList = web.Lists["Risks"]; foreach (SPField field in riskList.Fields) { System.Diagnostics.Trace.WriteLine(string.Format("field: {0}", field.Title)); } 这篇关于项目服务器的风险列表在Silverlight中不使用客户端对象模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-20 06:58
查看更多