문제

문서 라이브러리의 선택 필드에 값을 추가하고 선택하고 싶습니다.내가 기억하는 것보다 분명히 더 까다 롭다.

이런 일을하고 있지만 작동하지 않습니다.목록보기의 필드에 값이 추가되지만 선택 컬럼에는 추가되지 않습니다.

ClientContext ctx = new ClientContext("http://mymachine");
Web currentWeb = ctx.Web;
ctx.Load(currentWeb);
ctx.ExecuteQuery();

SP.List list = ctx.Web.Lists.GetByTitle("Doclib");
ctx.Load(list);
ctx.ExecuteQuery();

ListItemCollection items = list.GetItems(CamlQuery.CreateAllItemsQuery());
ctx.Load(items);
ctx.ExecuteQuery();


foreach (ListItem listItem in items)
{
    ctx.Load(listItem.File);
    ctx.ExecuteQuery();

    if (listItem.File.Name.Equals(fileName))
    {
        var processValue = "A Value";
        listItem["MetaProcess"] = processValue;
        //SP.FieldChoice itemType = ctx.CastTo<SP.FieldChoice>(list.Fields.GetByTitle("MetaProcess"));
        //itemType.Choices = new[] { "Agenda", "Agreement", "Full text", "Minutes", "News Item", "Reference" };
        //itemType.Update();
        //ctx.ExecuteQuery();
    }
    listItem.Update();
}
ctx.ExecuteQuery();
.

도움이 되었습니까?

해결책

SharePoint 용 Camelot .NET 커넥터를 사용하여 다른 경로에서 작동하도록 선택했습니다.

다른 팁

다음은 나를 위해 일합니다.

    calendarDropDown = (DropDownList)TemplateContainer.FindControl("calendarDropDown");
    if (ControlMode == SPControlMode.New || ControlMode == SPControlMode.Edit)
    {
        SPWeb currentWeb = SPContext.Current.Web;
        SPListCollection lists = currentWeb.Lists;
        foreach (SPList list in lists)
        {
            if (list.BaseTemplate == SPListTemplateType.Events)
            {
                calendarDropDown.Items.Add(list.Title);
            }
        }
    }
.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top