OneDrive SharePoint on-premises

AhmedMohamed 61 Reputation points
2020-08-21T11:15:40.85+00:00

Hi

we have SharePoint 2019 enterprise edition installed in our organizations, and we then Set up Microsoft OneDrive in a our SharePoint Server on-premises environment, i have a requirement for developing a custom solution and i want to access the shared files on onedrive programmatically, i couldn't find any resources about how to access or manage files on ondrive in on-premises environment, i only found onedrive development center site on Microsoft website but this development center only talking about ondrive for business ( office 365) .

any help please about how can i access onedrive programmatically (on-premises environment) ?

SharePoint Server
SharePoint Server
A family of Microsoft on-premises document management and storage systems.
2,235 questions
SharePoint Server Development
SharePoint Server Development
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Development: The process of researching, productizing, and refining new or existing technologies.
1,576 questions
SharePoint Server Management
SharePoint Server Management
SharePoint Server: A family of Microsoft on-premises document management and storage systems.Management: The act or process of organizing, handling, directing or controlling something.
2,816 questions
0 comments No comments
{count} votes

Accepted answer
  1. Jerryzy 10,566 Reputation points
    2020-08-24T02:57:58.347+00:00

    Hi @AhmedMadany-4915,

    In SharePoint On-Premise environment, the OneDrive for SharePoint is hosted in My Site Documents library:

    19737-snipaste-2020-08-24-10-53-29.png

    you could access the MySite library using CSOM or SSOM as Trever's suggestion :

    var siteurl = "http://sp/my/personal/administrator";
    using (ClientContext ctx=new ClientContext(siteurl))
    {
    List list = ctx.Web.Lists.GetByTitle("Documents");
    ListItemCollection items = list.GetItems(CamlQuery.CreateAllItemsQuery());
    ctx.Load(items);
    ctx.ExecuteQuery();
    }

    Reference:

    get list of files in a Folder in a SharePoint Library using CSOM

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Trevor Seward 11,686 Reputation points
    2020-08-22T19:09:51.4+00:00

    You can use CSOM or SSOM (Server-Side Object Model). There is no difference, from a development perspective, for accessing OneDrive sites versus standard SharePoint sites, so you can use objects like SPSite, SPFile, and so forth in your code.

    1 person found this answer helpful.
    0 comments No comments