简体   繁体   中英

How to get the Files by only File Name from Sharepoint

Currently I am getting the list of documents as following:

 private ClientContext _clientContext;
 var oList = _clientContext.Web.Lists.GetByTitle(SERVERURL);
 var oQuery = new CamlQuery();
 var fileList = oList.GetItems(oQuery);
_clientContext.Load(fileList);
_clientContext.ExecuteQuery();

It gives me all the files that is on the server.

But what if I know the files that I want to open from SharePoint and Read? I don't want to load all the files and then loop through them , instead want to get that particular file from SharePoint.

You may use your CamlQuery :

oQuery.Query = 
@"<Where>
    <Eq>
        <FieldRef Name='Title'/><Value Type='Text'>DocTitle</Value>
    </Eq>
</Where>";

For more details read Query Schema .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM