2010-06-22 1 views
3

SharePoint 웹 서비스를 사용하여 사용자에게 SharePoint 목록을 쿼리하고 표시하는 프로그램을 만들고 있습니다. 한 번에 하나의 열만 표시 할 수 있으므로 표시 할 기본 열 또는 표시 열을 찾아야합니다. 나는 '제목'이 많은 콘텐츠 유형에서 일반적으로 사용되는 것을 알고 있지만 모든 유형의 사용자 지정 콘텐츠 유형 또는 목록에 대해 강력하기를 원하므로이 필드를 찾기 위해 목록을 쿼리하는 몇 가지 방법을 찾고 싶습니다.(웹 서비스를 사용하는) Sharepoint 목록의 목록 항목에 대한 올바른 표시 이름/필드

예 : 여기 SharePoint Manager 2010을 사용 중이며 링크 라이브러리 (제목 필드가 없음)를보고 있지만 어떻게 든 목록 항목의 이름이 'http://google.com'임을 알고 있습니다. 이것을 어떻게 추론합니까? alt text http://www.adamburkepile.com/upload/splist.png

+0

우수 질문 - 도움이 될 수 있습니다 대답하지만 심판의 모르는 - 목록을 웹 서비스 http://msdn.microsoft.com/en-us/library/lists .lists.getlist (v = office.12) .aspx 필드를 포함하여 CAML 형식의 스키마를 제공합니다 http://msdn.microsoft.com/en-us/library/ms437580(v=office.12) .aspx – Ryan

답변

2

DisplayName처럼 보이지 않는 논리가 있습니다. 여기 내가 사용 얻은 코드는 반사판 :

public string DisplayName 
{ 
    get 
    { 
     if (!this.IsNew) 
     { 
      if ((!this.ParentList.AllowContentTypes && (this.ParentList.BaseType == SPBaseType.DocumentLibrary)) || (this.ParentList.AllowContentTypes && (this.ContentTypeId.IsNonDiscussionFolder || this.ContentTypeId.IsChildOf(SPBuiltInContentTypeId.Document)))) 
      { 
       string str = (string) this.GetValue("BaseName", false); 
       if (!string.IsNullOrEmpty(str)) 
       { 
        return SPHttpUtility.HtmlDecode(str); 
       } 
      } 
      SPField fieldByInternalName = this.Fields.GetFieldByInternalName("Title", false); 
      if (fieldByInternalName != null) 
      { 
       string fieldValueAsText = fieldByInternalName.GetFieldValueAsText(this.GetValue(fieldByInternalName, -1, false)); 
       if (!string.IsNullOrEmpty(fieldValueAsText)) 
       { 
        return fieldValueAsText; 
       } 
      } 
      if (this.ParentList.AllowContentTypes) 
      { 
       if (this.ContentTypeId.IsChildOf(SPBuiltInContentTypeId.Link)) 
       { 
        SPFieldUrlValue value2 = new SPFieldUrlValue((string) this.GetValue("URL", false)); 
        if (!string.IsNullOrEmpty(value2.Description)) 
        { 
         return value2.Description; 
        } 
        if (!string.IsNullOrEmpty(value2.Url)) 
        { 
         return value2.Url; 
        } 
       } 
       if (this.ContentTypeId.IsChildOf(SPBuiltInContentTypeId.Message)) 
       { 
        Guid discussionTitleLookup = SPBuiltInFieldId.DiscussionTitleLookup; 
        SPField fld = this.Fields[discussionTitleLookup]; 
        string str3 = fld.GetFieldValueAsText(this.GetValue(fld, -1, false)); 
        if (!string.IsNullOrEmpty(str3)) 
        { 
         return str3; 
        } 
       } 
      } 
      if (this.ParentList.BaseType != SPBaseType.Survey) 
      { 
       using (IEnumerator enumerator = this.Fields.GetEnumerator()) 
       { 
        SPField field3; 
        string str5; 
        while (enumerator.MoveNext()) 
        { 
         field3 = (SPField) enumerator.Current; 
         if (field3.GetFieldBoolValue("TitleField")) 
         { 
          goto Label_00C6; 
         } 
        } 
        goto Label_016F; 
       Label_00BB: 
        if (!(field3 is SPFieldMultiLineText)) 
        { 
         return str5; 
        } 
        goto Label_00ED; 
       Label_00C6: 
        str5 = field3.GetFieldValueAsText(this.GetValue(field3, -1, false)); 
        if (string.IsNullOrEmpty(str5)) 
        { 
         goto Label_016F; 
        } 
        goto Label_00BB; 
       Label_00ED: 
        if (str5.Length <= 0xff) 
        { 
         return str5; 
        } 
        return str5.Substring(0, 0xff); 
       } 
      } 
      SPContext context2 = SPContext.Current; 
      if ((context2 == null) || (context2.FormContext.FormMode != SPControlMode.Edit)) 
      { 
       return SPResource.GetString("ViewResponseTitle", new object[] { this.ID.ToString("N0", this.Web.Locale) }); 
      } 
      return SPResource.GetString("ToolBarMenuRespondToSurvey", new object[0]); 
     } 
     SPContext current = SPContext.Current; 
     if (this.ParentList.BaseType != SPBaseType.Survey) 
     { 
      if ((current != null) && current.FormContext.IsNonDiscussionFolder) 
      { 
       return SPResource.GetString("ButtonTextNewFolder", new object[0]); 
      } 
      return SPResource.GetString("NewFormTitleNewItem", new object[0]); 
     } 
     return SPResource.GetString("ToolBarMenuRespondToSurvey", new object[0]); 
    Label_016F: 
     return SPResource.GetString("NoTitle", new object[0]); 
    } 
} 
관련 문제