2017-08-30 110 views
1

使用測試版SharePoint REST API(使用Microsoft Graph)。 想要獲取列表中的所有項目,包括自定義字段的內容。從SharePoint列表項中獲取自定義字段

當我使用https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}?expand=columns,items(expand=fields)我看到(在我的情況下):包含32個字段,包括標準的人(例如IDTitleStatus)和自定義的(例如Next_action

    • columnsfields只包含默認值(在我的情況下爲23)字段,包括id [請注意是小寫],TitleStatus字段和-as expected-不是自定義字段。

    The documentation shows an example of getting specific columns。 當我使用https://graph.microsoft.com/beta/sites/{site-id}/lists/{list-id}/items?expand=fields(select=ID,Title,Status,Next_action)

    然後我得到的所有項目的數組,每個項目的對象fields僅包含屬性id

    所以:其他標準字段(TitleStatus)和自定義字段Next_action顯示不出來。

    如何獲取標準和自定義字段列表的值?


    編輯:約我有名單的詳細信息:

    一對夫婦名單的是已定製的(我相信任務,問題,風險),則是完全的自定義默認的(決定,變化)。任務列表具有版本控制。
    一些觀察:

    • 決定列表沒有丟失字段(= columns和實際fields之間沒有區別)
    • 所有的人都 「失蹤」:ID |作者|編輯| DocIcon | AppAuthor | AppEditor ,以及不在列中的字段:id | AuthorLookupId | EditorLookupId;這兩個都可以解釋我猜(注意在列中的ID和在字段中的ID)
    • 缺少的字段有多種類型:文本(富/平原,單/多行),數字,選擇等

    可能有關,使用Flow時,我會創建一個「創建或修改項目時」的觸發器,然後我只給出2個列表(更改和決定)。缺失:任務,風險,問題。

    任務

    • 場(19):「標題|前輩|優先級|狀態| PERCENTCOMPLETE | AssignedTo |身體|開始|對號|的ContentType |修改|創建| _UIVersionString |附件|編輯| LinkTitleNoMenu | LinkTitle | ItemChildCount | FolderChildCount」
    • 缺失(13): 「DUEDATE | RelatedItems | JIRA_id | Progress_notes | Next_action | Waiting_for |更新 | ID |作者|編輯| DocIcon | AppAuthor | AppEditor
    • 字段不在列(4)中:「[email protected] | ID | AuthorLookupId | EditorLookupId

    風險

    • 場(22):」 標題|狀態|分類| DUEDATE |概率|衝擊|曝光|成本| Cost_x0020_Exposure |說明| Mitigation_x0020_plan |觸發器|的ContentType |修改|創建| _UIVersionString |附件|編輯| LinkTitle | ItemChildCount | FolderChildCount 「
    • 失蹤(12):」 所有人| AssignedTo | Impact_x0020_description | Contingency_x0020_plan | Trigger_x0020_Description | RelatedIte ms | ID |作者|編輯| DocIcon | AppAuthor | AppEditor
    • 字段不是在列(7):」 OwnerLookupId | [email protected] | [email protected] |成本@的OData。鍵入 | ID | AuthorLookupId | EditorLookupId

    問題

    • 場(16):」 ContentType的|標題|修改|創建| _UIVersionString |附件|編輯| LinkTitleNoMenu | LinkTitle | ItemChildCount | FolderChildCount |狀態|分類|優先| DueDate |討論「
    • missing(10):」ID |作者|編輯| DocIcon | AppAuthor | AppEditor | 業主|分配|分辨率|相關項目
    • 字段不在列(5):」id | AuthorLookupId | EditorLookupId | OwnerLookupId | AssignedToLookupId

    決定

    • 字段(14):」 標題|描述| Decided_by | Date_decided |的ContentType |改性|創建| _UIVersionString |附件|編輯| LinkTitleNoMenu | LinkTitle | ItemChildCount | FolderChildCount」
    • 失蹤(6): 「ID |作者|編輯| DocIcon | AppAuthor | AppEditor
    • 領域未在列(3): 「ID | AuthorLookupId | EditorLookupId

    變化

    • 場(13):「標題|狀態|優先級|的ContentType |修改|創建| _UIVersionString |附件|編輯| LinkTitleNoMenu | LinkTitle | ItemChildCount | FolderChildCount 「
    • 失蹤(14):」 描述|行動|背景|衝擊| Impact_x0020_delivery_x0020_time | Impact_effort | Impact_functionality | Impact_cost | ID |作者|編輯| DocIcon | AppAuthor | AppEditor
    • 領域不列(3):」 ID | AuthorLookupId | EditorLookupId
  • 回答

    0

    似乎是當前/beta錯誤。端點各地$expand={field}($select={field})我看到了類似的結果

    但是我看到領域的完整列表,當我使用:

    /beta/sites/{site-id}/lists/{list-id}/items?$expand=fields

    我也能使用返回一套完整的列項和字段:

    /beta/sites/{site-id}/lists/{list-id}$expand=columns,items($expand=fields)

    暫時,你需要拉動整個收集和處理任何額外的處理你的應用。作爲測試版本,還有一些錯誤仍在制定中。這就是爲什麼不建議將其用於生產的原因。

    +0

    瞭解它是Beta版,目前在官方版本中不支持列表,所以我希望使用Beta版。你提到的兩個解決方法都給了我以前的結果(23個常規字段)。我是否需要做任何特殊的事情來獲取自定義列的值,例如在我的情況下:'Next_action'?我將如何「拉動整個收藏」和「處理額外的處理」? – wivku

    +0

    你可以添加'next_action'的列決定嗎?我在列表中的字段沒有問題。 –

    +0

    請原諒我的無知,你是說「添加列決定」是什麼意思? – wivku

    相關問題