我一直在网上搜索几个小时,但仍未找到修复方法。我在xml元素中从sharepoint检索数据,但每个元素只包含一些属性,而不是全部。那些缺少的属性也不是空的。这是代码:
var xmlDoc = new XmlDocument();
var ndQuery = xmlDoc.CreateNode(XmlNodeType.Element, "Query", "");
var ndViewFields = xmlDoc.CreateNode(XmlNodeType.Element, "ViewFields", "");
var ndQueryOptions = xmlDoc.CreateNode(XmlNodeType.Element, "QueryOptions", "");
ndViewFields.InnerXml = "<FieldRef Name='Title'/>";
ndQuery.InnerXml = queryString;
ndQueryOptions.InnerXml = @"<QueryOptions>
<IncludeMandatoryColumns>TRUE</IncludeMandatoryColumns>
<DateInUtc>TRUE</DateInUtc>
<ViewAttributes Scope='Recursive' />
</QueryOptions>";
var result = client.GetListItems(ConnectionDefinition.GetParameterParsedValue("ListName"), null, ndQuery.GetXElement(), ndViewFields.GetXElement(), null, ndQueryOptions.GetXElement(), null);
return result;
如果您知道为什么会这样,请帮助我吗? 干杯, Marji
这是预期要检索的xml行:
<z:row ows_Volume_x0020_Unit="mt" ows_Strike_x0020_Unit="CENT" ows_Price_x0020_Unit="AUD" ows_Fee_x0020_Unit="CENT" ows_PdfDownloadLink="http://xxx/Deal Sheets/TGPA200295.pdf, View/Download" ows_SubmittedOnLocal="10/08/2016 10:19:28 (London Time)" ows_Buy_x0020_Sell_x0020_Value123="SELL" ows_Volume123="22" ows_Trader1="Aaron" ows_Submitted_x0020_On1="2016-08-10 00:00:00" ows_Submitted_x0020_By123="mmk" ows_Strike1="432.4" ows_Recap_x0020_Attached123="1" ows_Profile1="APks" ows_Price_x0020_Formula1="CAPQ" ows_Price123="8946" ows_Period1="1/4/16 - 20/4/16" ows_Is_x0020_Complete1="1" ows_Form_x0020_Date1="2016-08-10 00:00:00" ows__x0046_ee123="49" ows__x0044_SN1="TGPA200295" ows_Delivery_x0020_Location123="HHUB" ows_Deal_x0020_Type123="Financial" ows_Counterparty123="Adan" ows_Commodity1="NG" ows_Comments1234="Helloooooooo " ows_Checked123="0" ows_Broker123="GFI" ows_Block_x0020_Trade123="0" ows_Account123="ASI" ows_LinkFilenameNoMenu="T200295.pdf" ows_Author="2241;#Marjan MK" ows_Created="2016-08-10 10:19:32" ows_Editor="1073741823;#System Account" ows_Modified="2016-08-10 10:19:36" ows_ID="294" ows_DocIcon="pdf"/>
以下是返回的内容:
<z:row ows_Title="T200295.pdf" ows_MetaInfo="294;#SubmittedOnLocal:SW|10/08/2016 10:19:28 (London Time)
vti_parserversion:SR|14.0.0.6123
vti_folderitemcount:IR|0
PdfFileType:SW|http://xxx/images/icpdf.png, http://xxx/icpdf.png
ContentType:SW|Deal Sheet
ContentTypeId:SW|0x010100CFF12A74B6114E438CC39F7B5192A34800F1BA5E970C1C194CB82D536581E235BB
vti_title:SW|TGPA200295.pdf
PdfDownloadLink:SW|http://xxx/Deal Sheets/TGPA200295.pdf, View/Download
vti_author:SR|TGPTRADING\\mmk
vti_documentsigned:BW|false
vti_modifiedby:SR|SHAREPOINT\\system
vti_foldersubfolderitemcount:IR|0
" ows__ModerationStatus="0" ows__Level="1" ows_Last_x0020_Modified="294;#2016-08-10T09:19:35Z" ows_ID="294" ows_UniqueId="294;#{755243DE-93CB-4D74-91DD-A1F0C3CA54A0}" ows_owshiddenversion="5" ows_FSObjType="294;#0" ows_Created_x0020_Date="294;#2016-08-10T09:19:31Z" ows_ProgId="294;#" ows_FileLeafRef="294;#T200295.pdf" ows_PermMask="0x1b03c431267" ows_Modified="2016-08-10T09:19:36Z" ows_HTML_x0020_File_x0020_Type="InfoPath.Document.3" ows_FileRef="294;#frontoffice/TGPA/Deal Sheets/T200295.pdf" ows_DocIcon="pdf" ows_Editor="1073741823;#System Account" />
答案 0 :(得分:0)
我对您的问题中使用的术语“属性”感到困惑,但根据您的编辑,我了解到您指的是SharePoint列表中的列。如果您想要所有列,只需不要使用ViewField
选项。不要在ViewField
中传递GetListItems()
(您可以使用空字符串)的任何值。