How to display SP Online Document Library items in Grid View and Download the document using CSOMSelectedValue property for a Autocomplete User ControlSharePoint Online Iterating through Document Libraries CSOMC# CSOM - Check if File Exists in Document LibraryRename the Uploaded Document in document library using the CSOMCan't upload file to Document Library using CSOMGet localized list/site name from SharePoint 2013 on-premise with CSOMSharePoint Online: Get Document Library Children Count Using CSOMCSOM - FileRef vs ServerUrl vs sp.listitem.ServerRelativeUrlHow to download FileVersion content from Sharepoint Online using CSOMC# : Update Items of SharePoint Library CSOM

How do I generate distribution of positive numbers only with min, max and mean?

Is dd if=/dev/urandom of=/dev/mem safe?

How can I stop myself from micromanaging other PCs' actions?

Why does RPM for a fixed-pitch propeller change with an aircraft's pitch?

Send a single HTML email from Thunderbird, overriding the default "plain text" setting

Weed in Massachusetts: underground roots, skunky smell when bruised

Convert every file from JPEG to GIF in terminal

What does "see" in "the Holy See" mean?

Are there any examples of technologies have been lost over time?

Will any serial mouse connect to Classic Macs?

How do I address my Catering staff subordinate seen eating from a chafing dish before the customers?

Why are so many countries still in the Commonwealth?

Area of parallelogram = Area of square. Shear transform

How can I create a pattern of parallel lines that are increasing in distance in Photoshop / Illustrator?

Print sums of all subsets

Iterate over non-const variables in C++

Keeping an "hot eyeball planet" wet

What is the lowest-speed bogey a jet fighter can intercept/escort?

AC contactor 1 pole or 2?

"I you already know": is this proper English?

Trapped in an ocean Temple in Minecraft?

TSA asking to see cell phone

Why doesn't current cancel in a generator?

What does コテッと mean?



How to display SP Online Document Library items in Grid View and Download the document using CSOM


SelectedValue property for a Autocomplete User ControlSharePoint Online Iterating through Document Libraries CSOMC# CSOM - Check if File Exists in Document LibraryRename the Uploaded Document in document library using the CSOMCan't upload file to Document Library using CSOMGet localized list/site name from SharePoint 2013 on-premise with CSOMSharePoint Online: Get Document Library Children Count Using CSOMCSOM - FileRef vs ServerUrl vs sp.listitem.ServerRelativeUrlHow to download FileVersion content from Sharepoint Online using CSOMC# : Update Items of SharePoint Library CSOM






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















In SharePoint Provided Hosted App , I want to display SharePoint online document library documents with Meta data in Gridview .On click on this document name in the gridview i want to download the documents.
How to display SP Online Document Library items in Grid View and Download the document using CSOM code.



Unable to bind Listitemcollection to gridview when Autogenerate columns is False. its thowing an error Title and other fields are not found.



Tried binding it Data Table. But unable to make document name as Hyper link or clickable control



 protected void BtnSearch_Click(object sender, EventArgs e)
{


using (var ctx = TokenHelper.GetClientContextWithAccessToken(siteUri.ToString(), accessToken))
{

List<ObjectA> _listA = new List<ObjectA>();

Web oWebsite = ctx.Web;
ctx.Load(oWebsite);
ctx.ExecuteQuery();
ctx.Load(oWebsite.CurrentUser);
ctx.ExecuteQuery();

// To Get Site Tile
string strtitle = ctx.Web.Title;
// To Getcurrent logged user
string strlog = ctx.Web.CurrentUser.LoginName;

List list = oWebsite.Lists.GetByTitle("Sampledocuments"); //.GetById(new Guid("ebe2bc9e-4f04-46fb-9a41-5baf16c1da57"));
var q = new CamlQuery() ViewXml = "<View><Query><Where><And><Eq><FieldRef Name='Account_x002d_Name' /><Value Type='Text'>data</Value></Eq><Eq><FieldRef Name='SalesForce_x002d_ID' /><Value Type='Text'>daat</Value></Eq></And></Where></Query></View>" ;
Microsoft.SharePoint.Client.ListItemCollection items = list.GetItems(q);
// Microsoft.SharePoint.Client.ListItemCollection it = list.GetItems(q);

ctx.Load(list);

ctx.Load(items);
ctx.ExecuteQuery();





DataTable dt = new DataTable();



dt.Columns.Add("Item ID", typeof(int));
dt.Columns.Add("Item Title", typeof(string));
dt.Columns.Add("Account Name", typeof(string));
dt.Columns.Add("Sales Force ID", typeof(string));
dt.Columns.Add("URL", typeof(string));
dt.Columns.Add("FileRef", typeof(string));
dt.Columns.Add("FileDirRef", typeof(string));


foreach (Microsoft.SharePoint.Client.ListItem item in items)

DataRow dr = dt.NewRow();
dr["Item ID"] = item["ID"];
dr["Item Title"] = item["Title"] != null ? item["Title"].ToString() : "";
dr["Account Name"] = item["Account_x002d_Name"] != null ? item["Account_x002d_Name"].ToString() : "";
dr["Sales Force ID"] = item["SalesForce_x002d_ID"] != null ? item["SalesForce_x002d_ID"].ToString() : "";
dr["URL"] = item["FileLeafRef"] != null ? item["FileLeafRef"].ToString() : "";
dr["FileRef"] = item["FileRef"] != null ? item["FileRef"].ToString() : "";
dr["FileDirRef"] = item["FileDirRef"] != null ? item["FileDirRef"].ToString() : "";
// FileLeafRef FileRef FileDirRef
dt.Rows.Add(dr);



GV.DataSource = dt;
GV.DataBind();









share|improve this question




























    0















    In SharePoint Provided Hosted App , I want to display SharePoint online document library documents with Meta data in Gridview .On click on this document name in the gridview i want to download the documents.
    How to display SP Online Document Library items in Grid View and Download the document using CSOM code.



    Unable to bind Listitemcollection to gridview when Autogenerate columns is False. its thowing an error Title and other fields are not found.



    Tried binding it Data Table. But unable to make document name as Hyper link or clickable control



     protected void BtnSearch_Click(object sender, EventArgs e)
    {


    using (var ctx = TokenHelper.GetClientContextWithAccessToken(siteUri.ToString(), accessToken))
    {

    List<ObjectA> _listA = new List<ObjectA>();

    Web oWebsite = ctx.Web;
    ctx.Load(oWebsite);
    ctx.ExecuteQuery();
    ctx.Load(oWebsite.CurrentUser);
    ctx.ExecuteQuery();

    // To Get Site Tile
    string strtitle = ctx.Web.Title;
    // To Getcurrent logged user
    string strlog = ctx.Web.CurrentUser.LoginName;

    List list = oWebsite.Lists.GetByTitle("Sampledocuments"); //.GetById(new Guid("ebe2bc9e-4f04-46fb-9a41-5baf16c1da57"));
    var q = new CamlQuery() ViewXml = "<View><Query><Where><And><Eq><FieldRef Name='Account_x002d_Name' /><Value Type='Text'>data</Value></Eq><Eq><FieldRef Name='SalesForce_x002d_ID' /><Value Type='Text'>daat</Value></Eq></And></Where></Query></View>" ;
    Microsoft.SharePoint.Client.ListItemCollection items = list.GetItems(q);
    // Microsoft.SharePoint.Client.ListItemCollection it = list.GetItems(q);

    ctx.Load(list);

    ctx.Load(items);
    ctx.ExecuteQuery();





    DataTable dt = new DataTable();



    dt.Columns.Add("Item ID", typeof(int));
    dt.Columns.Add("Item Title", typeof(string));
    dt.Columns.Add("Account Name", typeof(string));
    dt.Columns.Add("Sales Force ID", typeof(string));
    dt.Columns.Add("URL", typeof(string));
    dt.Columns.Add("FileRef", typeof(string));
    dt.Columns.Add("FileDirRef", typeof(string));


    foreach (Microsoft.SharePoint.Client.ListItem item in items)

    DataRow dr = dt.NewRow();
    dr["Item ID"] = item["ID"];
    dr["Item Title"] = item["Title"] != null ? item["Title"].ToString() : "";
    dr["Account Name"] = item["Account_x002d_Name"] != null ? item["Account_x002d_Name"].ToString() : "";
    dr["Sales Force ID"] = item["SalesForce_x002d_ID"] != null ? item["SalesForce_x002d_ID"].ToString() : "";
    dr["URL"] = item["FileLeafRef"] != null ? item["FileLeafRef"].ToString() : "";
    dr["FileRef"] = item["FileRef"] != null ? item["FileRef"].ToString() : "";
    dr["FileDirRef"] = item["FileDirRef"] != null ? item["FileDirRef"].ToString() : "";
    // FileLeafRef FileRef FileDirRef
    dt.Rows.Add(dr);



    GV.DataSource = dt;
    GV.DataBind();









    share|improve this question
























      0












      0








      0








      In SharePoint Provided Hosted App , I want to display SharePoint online document library documents with Meta data in Gridview .On click on this document name in the gridview i want to download the documents.
      How to display SP Online Document Library items in Grid View and Download the document using CSOM code.



      Unable to bind Listitemcollection to gridview when Autogenerate columns is False. its thowing an error Title and other fields are not found.



      Tried binding it Data Table. But unable to make document name as Hyper link or clickable control



       protected void BtnSearch_Click(object sender, EventArgs e)
      {


      using (var ctx = TokenHelper.GetClientContextWithAccessToken(siteUri.ToString(), accessToken))
      {

      List<ObjectA> _listA = new List<ObjectA>();

      Web oWebsite = ctx.Web;
      ctx.Load(oWebsite);
      ctx.ExecuteQuery();
      ctx.Load(oWebsite.CurrentUser);
      ctx.ExecuteQuery();

      // To Get Site Tile
      string strtitle = ctx.Web.Title;
      // To Getcurrent logged user
      string strlog = ctx.Web.CurrentUser.LoginName;

      List list = oWebsite.Lists.GetByTitle("Sampledocuments"); //.GetById(new Guid("ebe2bc9e-4f04-46fb-9a41-5baf16c1da57"));
      var q = new CamlQuery() ViewXml = "<View><Query><Where><And><Eq><FieldRef Name='Account_x002d_Name' /><Value Type='Text'>data</Value></Eq><Eq><FieldRef Name='SalesForce_x002d_ID' /><Value Type='Text'>daat</Value></Eq></And></Where></Query></View>" ;
      Microsoft.SharePoint.Client.ListItemCollection items = list.GetItems(q);
      // Microsoft.SharePoint.Client.ListItemCollection it = list.GetItems(q);

      ctx.Load(list);

      ctx.Load(items);
      ctx.ExecuteQuery();





      DataTable dt = new DataTable();



      dt.Columns.Add("Item ID", typeof(int));
      dt.Columns.Add("Item Title", typeof(string));
      dt.Columns.Add("Account Name", typeof(string));
      dt.Columns.Add("Sales Force ID", typeof(string));
      dt.Columns.Add("URL", typeof(string));
      dt.Columns.Add("FileRef", typeof(string));
      dt.Columns.Add("FileDirRef", typeof(string));


      foreach (Microsoft.SharePoint.Client.ListItem item in items)

      DataRow dr = dt.NewRow();
      dr["Item ID"] = item["ID"];
      dr["Item Title"] = item["Title"] != null ? item["Title"].ToString() : "";
      dr["Account Name"] = item["Account_x002d_Name"] != null ? item["Account_x002d_Name"].ToString() : "";
      dr["Sales Force ID"] = item["SalesForce_x002d_ID"] != null ? item["SalesForce_x002d_ID"].ToString() : "";
      dr["URL"] = item["FileLeafRef"] != null ? item["FileLeafRef"].ToString() : "";
      dr["FileRef"] = item["FileRef"] != null ? item["FileRef"].ToString() : "";
      dr["FileDirRef"] = item["FileDirRef"] != null ? item["FileDirRef"].ToString() : "";
      // FileLeafRef FileRef FileDirRef
      dt.Rows.Add(dr);



      GV.DataSource = dt;
      GV.DataBind();









      share|improve this question














      In SharePoint Provided Hosted App , I want to display SharePoint online document library documents with Meta data in Gridview .On click on this document name in the gridview i want to download the documents.
      How to display SP Online Document Library items in Grid View and Download the document using CSOM code.



      Unable to bind Listitemcollection to gridview when Autogenerate columns is False. its thowing an error Title and other fields are not found.



      Tried binding it Data Table. But unable to make document name as Hyper link or clickable control



       protected void BtnSearch_Click(object sender, EventArgs e)
      {


      using (var ctx = TokenHelper.GetClientContextWithAccessToken(siteUri.ToString(), accessToken))
      {

      List<ObjectA> _listA = new List<ObjectA>();

      Web oWebsite = ctx.Web;
      ctx.Load(oWebsite);
      ctx.ExecuteQuery();
      ctx.Load(oWebsite.CurrentUser);
      ctx.ExecuteQuery();

      // To Get Site Tile
      string strtitle = ctx.Web.Title;
      // To Getcurrent logged user
      string strlog = ctx.Web.CurrentUser.LoginName;

      List list = oWebsite.Lists.GetByTitle("Sampledocuments"); //.GetById(new Guid("ebe2bc9e-4f04-46fb-9a41-5baf16c1da57"));
      var q = new CamlQuery() ViewXml = "<View><Query><Where><And><Eq><FieldRef Name='Account_x002d_Name' /><Value Type='Text'>data</Value></Eq><Eq><FieldRef Name='SalesForce_x002d_ID' /><Value Type='Text'>daat</Value></Eq></And></Where></Query></View>" ;
      Microsoft.SharePoint.Client.ListItemCollection items = list.GetItems(q);
      // Microsoft.SharePoint.Client.ListItemCollection it = list.GetItems(q);

      ctx.Load(list);

      ctx.Load(items);
      ctx.ExecuteQuery();





      DataTable dt = new DataTable();



      dt.Columns.Add("Item ID", typeof(int));
      dt.Columns.Add("Item Title", typeof(string));
      dt.Columns.Add("Account Name", typeof(string));
      dt.Columns.Add("Sales Force ID", typeof(string));
      dt.Columns.Add("URL", typeof(string));
      dt.Columns.Add("FileRef", typeof(string));
      dt.Columns.Add("FileDirRef", typeof(string));


      foreach (Microsoft.SharePoint.Client.ListItem item in items)

      DataRow dr = dt.NewRow();
      dr["Item ID"] = item["ID"];
      dr["Item Title"] = item["Title"] != null ? item["Title"].ToString() : "";
      dr["Account Name"] = item["Account_x002d_Name"] != null ? item["Account_x002d_Name"].ToString() : "";
      dr["Sales Force ID"] = item["SalesForce_x002d_ID"] != null ? item["SalesForce_x002d_ID"].ToString() : "";
      dr["URL"] = item["FileLeafRef"] != null ? item["FileLeafRef"].ToString() : "";
      dr["FileRef"] = item["FileRef"] != null ? item["FileRef"].ToString() : "";
      dr["FileDirRef"] = item["FileDirRef"] != null ? item["FileDirRef"].ToString() : "";
      // FileLeafRef FileRef FileDirRef
      dt.Rows.Add(dr);



      GV.DataSource = dt;
      GV.DataBind();






      c# asp.net csom






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 17:27









      PraveenPraveen

      11 bronze badge




      11 bronze badge






















          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363010%2fhow-to-display-sp-online-document-library-items-in-grid-view-and-download-the-do%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55363010%2fhow-to-display-sp-online-document-library-items-in-grid-view-and-download-the-do%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript