2017-02-03 89 views
1

我在sharepoint中使用連接查詢。但是當我從查找列表中獲得值時,似乎出現錯誤。值不在「Microsoft.SharePoint.Client.ServerException」的預期範圍內,

這裏是我的設計

  • 文檔作爲文檔庫類型有一個編號

    Id | DocLeafRef 
    ---+------------- 
    1 | Document A 
    2 | Document B 
    
  • 活動列表中,有一個外鍵 'e8_document' 是參照上述文件ID

    Id | e8_document | Name 
    ---+-------------+----------- 
    1 | 1   | Activity A 
    2 | 1   | Activity B 
    3 | 1   | Activity C 
    4 | 2   | Activity D 
    

這是我需要得到的結果。

Id | e8_document | Name  | DocLeafRef 
---+-------------+-------------------------- 
1 | 1   | Activity A | Document A 
2 | 1   | Activity B | Document A 
3 | 1   | Activity C | Document A 
4 | 2   | Activity D | Document B 

任何人都可以幫助我什麼是我的查詢錯誤。這裏是我的查詢

<View> 
    <ViewFields> 
    <FieldRef Name = 'DocLeafRef'/> 
    <FieldRef Name = 'ID'/> 
    <FieldRef Name = 'e8_document'/> 
    <FieldRef Name = 'Title'/> 
    <FieldRef Name = 'Author'/> 
    <FieldRef Name = 'Created'/> 
    </ViewFields> 
    <Joins> 
    <Join Type = 'INNER' ListAlias = 'Documents'> 
     <Eq> 
     <FieldRef Name ='e8_document' RefType = 'Id'/> 
     <FieldRef Name ='ID' List ='Documents'/> 
     </Eq> 
    </Join> 
    </Joins> 
    <ProjectedFields> 
    <Field ShowField ='FileLeafRef' Type ='Lookup' Name ='DocLeafRef' List ='Documents'/> 
    </ProjectedFields> 
    <Query> 
    <Where> 
     <Eq> 
      <FieldRef Name='e8_caseId'></FieldRef> 
      <Value Type = 'Number'>23</Value> 
     </Eq> 
    </Where> 
    </Query> 
</View> 

這裏是例外 Value does not fall within the expected range

回答

1

有可能的問題是,FileLeafRef是不是可以在投影領域中使用的字段類型之一。

請參閱文檔here

只有下列類型的字段可以被包括在一個ProjectedFields元件:

•計算值(視爲純文本)

•ContentTypeId

•計數器

•貨幣

•日期時間

•的Guid

•整數

•注(一個行只)

•號碼

•文本

+0

什麼辦法讓其他字段類型,它們ProjectedFields做不支持像UniqueId(查找類型)和FileLeafRef(文件類型)? –

+1

您可以使用工作流自動將所需的字段值複製到文本字段,然後在投影中顯示該文本字段。 – Thriggle

+0

你有什麼樣的例子嗎? –

相關問題