سؤال

لدي مشكلة في إعداد الحقل في حدث تحديث العنصر في مكتبة المستندات باستخدام SharePoint 2007.

لدي الموقف التالي، لدي مكتبة مستندات، وعندما أقوم بإضافة مستند استنادا إلى "Lookupfield"، أرغب في إضافة قيم إلى حقل بحث آخر مع منتقي، لكنه فشل.

ولكن إذا كان لدي مستند بالفعل في مكتبة المستندات وفي خصائص تحرير، أقوم بتعديل العنصر وأنت قمت بتحديثه، ثم يقوم بتحديث الحقل.

لقد لاحظت بعض التناقضات في هذا، وهي عندما أقوم بتحديث Miss إلى حقل هذا النوع من البيانات: 58؛ #somevalue؛ # 59؛ # somevalue2؛ # 60؛ # somvalue3 ...

ولكن عندما أضيف مستند في القالب، أعدد حقل البحث، أحصل على الاشياء التالية لتمرير إلى حقل بحث آخر مع منتقي: 58؛ #؛ # 60؛ #

لذلك فهذا يعني أنه يمر معرف ذلك، لكن القيم فارغة، ولكن يبدو أنني بحاجة إلى قيم أيضا، لجعلها تعمل.

i h افي الرمز التالي: giveacodicetagpre.

آمل أن يستطيع أي شخص أن ينصحني بشيء ... شكرا لك

هل كانت مفيدة؟

المحلول

Take reference to lookup list and use List.GetItemById(Id) to get the item and take the column value and construct the lookup collection. Example: SPList lookupList=properties.web.lists["lookupListName"]; SPListItem lookuplistitem=lookupList.GetItemById(4); //Here Id is 4 string filedvalue=lookuplistitem["lookupfieldname"];//Which field you are taking as lookup now construct the fieldlookup and do the same for all id's and construct fieldlookupvaluecollection.

List.GetItemById(Id) query is faster so you will not get much performance issues.

نصائح أخرى

As per my understanding there are two lookups from same list/library. SPFieldLookupValueCollection for each field is different. The format is ID;#Value here ID is listitem ID and Value is what you stored for respective fields in lookup list.

For "LookUpField" "ID;#LookUpFieldValue"

For "LookUpFieldWithPicker" "ID;#LookUpFieldWithPickerValue"

Before updating the listitem you have to construct the lookup collection like this

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى sharepoint.stackexchange
scroll top