2

クライアントオブジェクトモデルを使用して共有カレンダーイベントを作成しようとしています。私はアイテムを作成し、 "EndDate"カラムを除くすべてのカラム値を設定することができます。この列を設定しようとすると、次のエラーが表示されます。ドイツ語からのメッセージの翻訳は、「リストエントリを更新する際に無効なデータが使用されています。この列をスキップすると、Sharepointサーバーで作成されたアイテムがenddateプロパティなしで一覧表示されますが、カレンダービューでは表示されません。私は、ビューの「datasheetview」タイプのアイテムを見ることができる、と私はここから終了日を設定した場合には、カレンダービューにも表示されている。(奇妙なことに、それは必須項目です)クライアントオブジェクトモデルを使用して共有カレンダーリストアイテムを作成する方法

Server Exception Microsoft.SharePoint.Client.ServerException was unhandled. Message=Es wurden ungültige Daten zur Aktualisierung des Listeneintrags verwendet. Das Feld, das Sie aktualisieren möchten, ist möglicherweise schreibgeschützt. Source=Microsoft.SharePoint.Client.Runtime ServerErrorCode=-2147024809 ServerErrorTypeName=System.ArgumentException ServerStackTrace="" StackTrace: 
     at Microsoft.SharePoint.Client.ClientRequest.ProcessResponseStream(Stream responseStream) 
    at Microsoft.SharePoint.Client.ClientRequest.ProcessResponse() 
     at Microsoft.SharePoint.Client.ClientRequest.ExecuteQueryToServer(ChunkStringBuilder sb) 
     at Microsoft.SharePoint.Client.ClientRequest.ExecuteQuery() 
     at Microsoft.SharePoint.Client.ClientRuntimeContext.ExecuteQuery() 
     at Microsoft.SharePoint.Client.ClientContext.ExecuteQuery() 
     at Sp_Ctx.Program.Main(String[] args) in_Ctx\Program.cs:line 129 InnerException: 

は、次のように私のコードがあります
using (ClientContext ctx = ClaimClientContext.GetAuthenticatedContext(targetSite)){ if (ctx != null) { 
ctx.Load(ctx.Web); // Query for Web 

    ctx.ExecuteQuery(); // Execute 
      Console.WriteLine(ctx.Web.Title); 
      List list = ctx.Web.Lists.GetByTitle("calendarListName"); 
      ctx.Load(list.Fields); 
      ctx.ExecuteQuery(); 
      var newItem = list.AddItem(listItemCreationInfo); 
      newItem.Update();   
      newItem["Title"] = "myCalendar" ..... 
      newItem["EventDate"]= DateTime.Now; 
      newItem["EndDate"]= DateTime.Now.AddMinutes(30); 
      newItem["Location"]= "Office"; 
      newItem.Update(); 
      ctx.ExecuteQuery(); 

} 
+0

終了日ではなく期間を使用しましたか? – Servy

+0

Yeppですが、設定時間は効果がありません。たとえ私が設定しても何のエラーも与えず、値は変わらない。私は計算された列のようだと思う。 – haltunbay

+0

私は高い期待を持っていませんでした(したがって、答えではなくコメント)が、試してみる価値がありました。 – Servy

答えて

1

回答は単純でしたが、eventdateとenddateを一緒に更新しました。元の解決策はcan be seen here

関連する問題