필드를 만들 대리자 안에 다음 코드가 있습니다.대리인 내부의 기존 목록에서 필드를 확인하는 동안 SharePoint 항목을 업데이트 할 수 없습니다.
delegate(SPList list)
{
list.Fields.Add(...);
//I teared off the other same strings
}
다음 코드에서이 코드를 호출했습니다.
modifyFunction.Invoke(list);
//modifyFunction is a previous delegate, that was declared like
//delegate void ModifyList(SPList list);
따라서이 목록에서 항목을 업데이트하려고하면 모든 것이 잘되었습니다. 하지만 필자는 필드를 목록에 동적으로 추가해야했습니다. 그래서, 내 대리인을
delegate(SPList list)
{
CheckMethod(list);
}
void CheckMethod(SPList list)
{
if (!list.Fields.ContainsField(...))
{
list.Fields.Add(...);
}
}
변경했습니다.이 수정 후 (이 코드의 수정 사항이 더 이상)이 목록의 항목을 업데이트하는 동안 나는 다음 예외가 있습니다.
Invalid data has been used to update the list item. The field you are trying to update may be read only
SPWeb.AllowUnsafeUpdates 나 SPSecurity.RunWithElevatedPrivileges는 긍정적 인 결과를주지 못했습니다. 그 트릭은 어디 있습니까? 나는 어떤 도움을 주셔서 감사하겠습니다. 고맙습니다.