2011-08-11 5 views
0

EvenReceiverの一部として、カスタムリスト(ソース)上のitemAddedは別のリスト(ターゲット)にカレンダーエントリを作成します。Sharepoint List(カレンダー)を別の(カスタム)から更新するにはどうすればよいですか?

ここで、ソースリストが更新されると、変更がターゲットリストにフィルタされるようにitemUpdatedイベントを追加します。

Visual Studioでc#を使用してイベントレシーバを開発しています。

これを行う最善の方法と、ソースからターゲットに更新できるように、2つのリスト間のリンクをどのように作成するのかアドバイスをいただけますか?

ありがとうございます。

答えて

0

あなたはターゲットリストを自分でUDPATEする必要があります...コードのこの作品がまっすぐに私の頭の外に;-) &テストされていないことを

var sourceItem = this.properties.ListItem; 

//you can use other properties to search for the item in the targetlist aswell 
string query = string.Format("<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>{0}</Value></Eq></Where>", sourceItem.Title); 

var spQuery = new SPQuery() { Query = query }; 
var foundItems = targetList.GetItems(spQuery); 

if(foundItems.Count == 1) 
{ 
    var foundItem = foundItems[0]; 

    //update the properties you want 
    foundItem["Property1"] = sourceItem["Property1"]; 
    foundItem["Property2"] = sourceItem["Property2"]; 
    foundItem["Property3"] = sourceItem["Property3"]; 

    foundItem.Update(); 
} 

関連する問題