Accessing the items of other List through Event receiver of a List
-
08-02-2021 - |
문제
I have two lists "List A" and "List B"
List B has columns:
Color [Single line of text] Description [Multiple lines of text]
and now how can I get the "Color" and "Description" of the second Item present in the "List B" by triggering an Event Receiver in List A ??
Can anyone please help me ??
P.s : All Items that are present in the List Bhave unique Colors and Description.
해결책
Sample code for your reference.
public override void ItemAdding(SPItemEventProperties properties)
{
using (SPWeb oWeb = properties.OpenWeb())
{
SPList oList = oWeb.Lists.TryGetList("listB");
SPListItem item = oList.GetItemById(2);
object color = item["Color"];
object des = item["Des"];
}
base.ItemAdding(properties);
}
제휴하지 않습니다 sharepoint.stackexchange