2015-10-19 141 views
0

我有一個單詞(docx)文檔存儲在OneDrive for business上。它具有如下的結構:SharePoint搜索查詢

<title> 
Book Title 
</title> 
<author> 
High 
</author> 

然後我用Microsoft.SharePoint.Client搜索標題和作者

var targetSite = new Uri("https://my-site.sharepoint.com"); 
    var login = "login"; 
    var password = "pass"; 
    var securePassword = new SecureString(); 
    foreach (char c in password) 
    { 
     securePassword.AppendChar(c); 
    } 
var onlineCredentials = new SharePointOnlineCredentials(login, securePassword); 

using (ClientContext clientContext = new ClientContext(targetSite)) 
{ 
    clientContext.Credentials = onlineCredentials; 

    var query = new KeywordQuery(clientContext); 
    query.QueryText = "<title></title><author></author>"; 
    var searchExecutor = new SearchExecutor(clientContext); 
    var result = searchExecutor.ExecuteQuery(query); 
    clientContext.ExecuteQuery(); 

} 

但它不工作。它只返回單詞標題和作者。我究竟做錯了什麼?

+0

我想找到標籤之間的數據。 – <span class="text-secondary"> <small> <span></span> </small> </span> </p> </div> </div> </div> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+0</span></div> <div class="col-lg-11"> <p class="commenttext">如果在問題中指定它會更好,因爲它不是那麼容易理解,並且也是一個相當奇怪的要求。 – <span class="text-secondary"> <small> <span></span> </small> </span> </p> </div> </div> </div> </div> </div> </article> </div> <div class="answer-title"> <span class="text-logo margin-top-sm">A</span> <h2 class="title h4">回答</h2> </div> <div class="item-description text-md markdown-body margin-bottom-40 voidso"> <article class="board-top-1 padding-top-10"> <div class="post-col vote-info"> <span class="count">0<i class="fa fa-thumbs-up"></i></span> </div> <div class="post-offset"> <div class="answer fmt"> <p>語法應遵循<em>關鍵字查詢語言</em>規範(你使用<code class="prettyprint-override">KeywordQuery</code>)</p> <p><a href="https://msdn.microsoft.com/en-us/library/office/ee558911.aspx" rel="nofollow">Keyword Query Language (KQL) syntax reference</a></p> <p>對於你問什麼,你應該使用類似</p> <pre><code class="prettyprint-override">query.QueryText = "Author:John AND Title:Test*"; </code></pre> </div> <div class="post-info"> <div class="post-meta row"> <p class="text-secondary col-lg-6"> <span class="source"> <a rel="noopener" target="_blank" href="https://stackoverflow.com/q/33210987">來源</a> </span> </p> <p class="text-secondary col-lg-6"> <span class="float-right date"> <span>2015-10-19 09:28:41</span> </p> <p class="col-12"></p> <p class="col-12"></p></div> </div> <!-- comments --> <div class="comments"> <div itemprop="comment" class="post-comment"> <div class="row"> <div class="col-lg-1"><span class="text-secondary">+1</span></div> <div class="col-lg-11"> <p class="commenttext">這種方法不起作用。 – <span class="text-secondary"> <small> <span></span> </small> </span> </p> </div> </div> </div> </div> </div> </article> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1038284119" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="clearfix"> </div> <div class="relative-box"> <div class="relative">相關問題</div> <ul class="relative_list"> <li> 1. <a href="http://hk.uwenku.com/question/p-zsrcqtst-dq.html" target="_blank" title="SharePoint 2010搜索查詢"> SharePoint 2010搜索查詢 </a> </li> <li> 2. <a href="http://hk.uwenku.com/question/p-tadezymq-dp.html" target="_blank" title="SharePoint搜索關鍵字查詢"> SharePoint搜索關鍵字查詢 </a> </li> <li> 3. <a href="http://hk.uwenku.com/question/p-ziakzdom-bbb.html" target="_blank" title="Sharepoint。使用CAML查詢搜索項目"> Sharepoint。使用CAML查詢搜索項目 </a> </li> <li> 4. <a href="http://hk.uwenku.com/question/p-shgeewwp-gp.html" target="_blank" title="查詢和/或搜索SharePoint文檔ID"> 查詢和/或搜索SharePoint文檔ID </a> </li> <li> 5. <a href="http://hk.uwenku.com/question/p-noswrnmz-hu.html" target="_blank" title="XPath查詢搜索"> XPath查詢搜索 </a> </li> <li> 6. <a href="http://hk.uwenku.com/question/p-brmfpngm-vt.html" target="_blank" title="MySQL搜索查詢?"> MySQL搜索查詢? </a> </li> <li> 7. <a href="http://hk.uwenku.com/question/p-boorhmdz-wa.html" target="_blank" title="mysql搜索查詢"> mysql搜索查詢 </a> </li> <li> 8. <a href="http://hk.uwenku.com/question/p-hpwxpfat-zp.html" target="_blank" title="SQL查詢搜索"> SQL查詢搜索 </a> </li> <li> 9. <a href="http://hk.uwenku.com/question/p-wuoupmsk-bdw.html" target="_blank" title="搜索查詢3.5"> 搜索查詢3.5 </a> </li> <li> 10. <a href="http://hk.uwenku.com/question/p-kzupwehy-bdx.html" target="_blank" title="PDO搜索查詢"> PDO搜索查詢 </a> </li> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block; text-align:center;" data-ad-layout="in-article" data-ad-format="fluid" data-ad-client="ca-pub-6208739752673518" data-ad-slot="4606349252"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <li> 11. <a href="http://hk.uwenku.com/question/p-flkshxfd-bkh.html" target="_blank" title="Laravel搜索查詢"> Laravel搜索查詢 </a> </li> <li> 12. <a href="http://hk.uwenku.com/question/p-zhmhuzbx-bkm.html" target="_blank" title="Mysql搜索查詢"> Mysql搜索查詢 </a> </li> <li> 13. <a href="http://hk.uwenku.com/question/p-rbpsffnd-bmt.html" target="_blank" title="DateTime查詢搜索"> DateTime查詢搜索 </a> </li> <li> 14. <a href="http://hk.uwenku.com/question/p-ddigfrkz-cy.html" target="_blank" title="SQL搜索查詢"> SQL搜索查詢 </a> </li> <li> 15. <a href="http://hk.uwenku.com/question/p-xncgtjmh-tt.html" target="_blank" title="LINQ搜索查詢"> LINQ搜索查詢 </a> </li> <li> 16. <a href="http://hk.uwenku.com/question/p-vdcdpkgq-kr.html" target="_blank" title="SQLite搜索查詢"> SQLite搜索查詢 </a> </li> <li> 17. <a href="http://hk.uwenku.com/question/p-hswwplio-yn.html" target="_blank" title="Wordpress搜索查詢"> Wordpress搜索查詢 </a> </li> <li> 18. <a href="http://hk.uwenku.com/question/p-nxgmrhdv-bmk.html" target="_blank" title="lucene查詢搜索"> lucene查詢搜索 </a> </li> <li> 19. <a href="http://hk.uwenku.com/question/p-xzbkfwma-v.html" target="_blank" title="SQL搜索查詢"> SQL搜索查詢 </a> </li> <li> 20. <a href="http://hk.uwenku.com/question/p-zmfkpitv-o.html" target="_blank" title="Mysql查詢搜索"> Mysql查詢搜索 </a> </li> <li> 21. <a href="http://hk.uwenku.com/question/p-rcffabjq-dd.html" target="_blank" title="搜索MySQL查詢"> 搜索MySQL查詢 </a> </li> <li> 22. <a href="http://hk.uwenku.com/question/p-hqtptzir-ck.html" target="_blank" title="sql - 搜索查詢"> sql - 搜索查詢 </a> </li> <li> 23. <a href="http://hk.uwenku.com/question/p-caozynta-tw.html" target="_blank" title="Adonis.js搜索查詢"> Adonis.js搜索查詢 </a> </li> <li> 24. <a href="http://hk.uwenku.com/question/p-soxhxzbm-bba.html" target="_blank" title="Marklogic搜索查詢"> Marklogic搜索查詢 </a> </li> <li> 25. <a href="http://hk.uwenku.com/question/p-sxbbatvz-bnv.html" target="_blank" title="SPARQL搜索查詢"> SPARQL搜索查詢 </a> </li> <li> 26. <a href="http://hk.uwenku.com/question/p-kxvohgco-tt.html" target="_blank" title="搜索與EdgeNGramFilterFactory和搜索查詢"> 搜索與EdgeNGramFilterFactory和搜索查詢 </a> </li> <li> 27. <a href="http://hk.uwenku.com/question/p-tithcrmn-xz.html" target="_blank" title="修改搜索查詢網站搜索"> 修改搜索查詢網站搜索 </a> </li> <li> 28. <a href="http://hk.uwenku.com/question/p-kagaweni-bce.html" target="_blank" title="SQL搜索查詢應先在搜索"> SQL搜索查詢應先在搜索 </a> </li> <li> 29. <a href="http://hk.uwenku.com/question/p-tvvlntdw-gu.html" target="_blank" title="mysql搜索查詢搜索很多列"> mysql搜索查詢搜索很多列 </a> </li> <li> 30. <a href="http://hk.uwenku.com/question/p-pgczqark-bds.html" target="_blank" title="彈性搜索管道搜索查詢"> 彈性搜索管道搜索查詢 </a> </li> </ul> </div> <div> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-format="autorelaxed" data-ad-client="ca-pub-6208739752673518" data-ad-slot="1575177025"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="padding-top-10"></div> </div> </div> <script type="text/javascript" src="http://img.uwenku.com/uwenku/script/side.js?t=1644592048261"></script> <script type="text/javascript" src="http://img.uwenku.com/uwenku/plugin/highlight/highlight.pack.js"></script> <link href="http://img.uwenku.com/uwenku/plugin/highlight/styles/docco.css" media="screen" rel="stylesheet" type="text/css" /> <script type="text/javascript"> $('pre').each(function(i, e) { hljs.highlightBlock(e, "<span class='indent'> </span>", false) }); </script> <div class="col-lg-3 col-md-4 col-sm-5"> <div id="rightTop"> <div class="row"> <script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-6208739752673518" data-ad-slot="5415218910" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> <div class="row sidebar panel panel-default"> <div class="panel-heading font-bold"> 最新問題 </div> <div class="m-b-sm m-t-sm clearfix"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-vscpigug-bax.html" target="_blank" title="ABCreateStringWithAddressDictionary棄用"> ABCreateStringWithAddressDictionary棄用 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-bwklmodm-bar.html" target="_blank" title="將一個字符串的第一個實例替換爲一個變量或其他唯一字符串"> 將一個字符串的第一個實例替換爲一個變量或其他唯一字符串 </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-ptvbuqar-wt.html" target="_blank" title="從psd獲取座標"> 從psd獲取座標 </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-pyjtovbc-xg.html" target="_blank" title="在TextView中更改textSize"> 在TextView中更改textSize </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-aghfygub-wz.html" target="_blank" title="用於日常報告"> 用於日常報告 </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-oiodcgkp-yy.html" target="_blank" title="如何更新卡片視圖佈局點擊它時?"> 如何更新卡片視圖佈局點擊它時? </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-aiksxqoc-ys.html" target="_blank" title="如何在ns3中實現GPSR算法?"> 如何在ns3中實現GPSR算法? </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-ogodjzve-zp.html" target="_blank" title="MVC/Entity Framework編輯動作"> MVC/Entity Framework編輯動作 </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-qpxsqqbb-ze.html" target="_blank" title="PL/SQL:如何將行組合成一個字符串"> PL/SQL:如何將行組合成一個字符串 </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-azhrqsib-xw.html" target="_blank" title="如何在Google端點響應中發送自定義標頭"> 如何在Google端點響應中發送自定義標頭 </a> </li> </ul> </div> </div> </div> <p class="article-nav-bar"></p> <div class="row sidebar article-nav"> <div class="row box_white visible-sm visible-md visible-lg margin-zero"> <div class="top"> <h3 class="title"><i class="glyphicon glyphicon-th-list"></i> 相關問題</h3> </div> <div class="article-relative-content"> <ul class="side_article_list"> <li class="side_article_list_item"> 1. <a href="http://hk.uwenku.com/question/p-zsrcqtst-dq.html" target="_blank" title="SharePoint 2010搜索查詢"> SharePoint 2010搜索查詢 </a> </li> <li class="side_article_list_item"> 2. <a href="http://hk.uwenku.com/question/p-tadezymq-dp.html" target="_blank" title="SharePoint搜索關鍵字查詢"> SharePoint搜索關鍵字查詢 </a> </li> <li class="side_article_list_item"> 3. <a href="http://hk.uwenku.com/question/p-ziakzdom-bbb.html" target="_blank" title="Sharepoint。使用CAML查詢搜索項目"> Sharepoint。使用CAML查詢搜索項目 </a> </li> <li class="side_article_list_item"> 4. <a href="http://hk.uwenku.com/question/p-shgeewwp-gp.html" target="_blank" title="查詢和/或搜索SharePoint文檔ID"> 查詢和/或搜索SharePoint文檔ID </a> </li> <li class="side_article_list_item"> 5. <a href="http://hk.uwenku.com/question/p-noswrnmz-hu.html" target="_blank" title="XPath查詢搜索"> XPath查詢搜索 </a> </li> <li class="side_article_list_item"> 6. <a href="http://hk.uwenku.com/question/p-brmfpngm-vt.html" target="_blank" title="MySQL搜索查詢?"> MySQL搜索查詢? </a> </li> <li class="side_article_list_item"> 7. <a href="http://hk.uwenku.com/question/p-boorhmdz-wa.html" target="_blank" title="mysql搜索查詢"> mysql搜索查詢 </a> </li> <li class="side_article_list_item"> 8. <a href="http://hk.uwenku.com/question/p-hpwxpfat-zp.html" target="_blank" title="SQL查詢搜索"> SQL查詢搜索 </a> </li> <li class="side_article_list_item"> 9. <a href="http://hk.uwenku.com/question/p-wuoupmsk-bdw.html" target="_blank" title="搜索查詢3.5"> 搜索查詢3.5 </a> </li> <li class="side_article_list_item"> 10. <a href="http://hk.uwenku.com/question/p-kzupwehy-bdx.html" target="_blank" title="PDO搜索查詢"> PDO搜索查詢 </a> </li> </ul> </div> </div> </div> </div> </div> </div> </div><!-- wrap end--> <!-- footer --> <footer id="footer"> <div class="bg-simple lt"> <div class="container"> <div class="row padder-v m-t"> <div class="col-xs-8"> <ul class="list-inline"> <li><a href="http://hk.uwenku.com/contact">聯系我們</a></li> <li>© 2020 HK.UWENKU.COM</li> <li><a target="_blank" href="https://beian.miit.gov.cn/">沪ICP备13005482号-4</a></li> <li><script type="text/javascript" src="https://v1.cnzz.com/z_stat.php?id=1280101193&web_id=1280101193"></script></li> <li><a href="http://www.uwenku.com/" target="_blank" title="优文库">简体中文</a></li> <li><a href="http://hk.uwenku.com/" target="_blank" title="優文庫">繁體中文</a></li> <li><a href="http://ru.uwenku.com/" target="_blank" title="поле вопросов и ответов">Русский</a></li> <li><a href="http://de.uwenku.com/" target="_blank" title="Frage - und - antwort - Park">Deutsch</a></li> <li><a href="http://es.uwenku.com/" target="_blank" title="Preguntas y respuestas">Español</a></li> <li><a href="http://hi.uwenku.com/" target="_blank" title="कार्यक्रम प्रश्न और उत्तर पार्क">हिन्दी</a></li> <li><a href="http://it.uwenku.com/" target="_blank" title="IL Programma di chiedere Park">Italiano</a></li> <li><a href="http://ja.uwenku.com/" target="_blank" title="プログラム問答園区">日本語</a></li> <li><a href="http://ko.uwenku.com/" target="_blank" title="프로그램 문답 단지">한국어</a></li> <li><a href="http://pl.uwenku.com/" target="_blank" title="program o park">Polski</a></li> <li><a href="http://tr.uwenku.com/" target="_blank" title="Program soru ve cevap parkı">Türkçe</a></li> <li><a href="http://vi.uwenku.com/" target="_blank" title="Đáp ứng viên">Tiếng Việt</a></li> <li><a href="http://fr.uwenku.com/" target="_blank" title="Programme interrogation Park">Française</a></li> </ul> </div> </div> </div> </div> </div> </footer> <!-- / footer --> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?f78a970f17b19a79fc477a3378096f29"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </body> </html>