1
votes

I have a Winform App that is currently in production. It runs several reports to PDF and puts them on a shared drive. In this process it creates several directories and places these PDF's in the proper Directory.

I can copy the files to a SharePoint location, I just can’t create the Directories. How can I create a SharePoint Directory without having SharePoint installed on my machine? Is it Possible?

I’m using VS2010 and from what I’m reading I can’t install SharePoint on my machine because I am running on a 32bit OS

EDIT: I’m still pretty new to SharePoint 2010 so I may not have the terms down yet. I have a Document Library set up on our site. When I am in that DL on SharePoint I can click on the Library tab at the top of the page and go to “Open with Explorer.” With the explorer open, I can right click and create a folder. I can also paste all my files with their folder structures. So, maybe what EtherDragon suggest with using the dll’s might work, I’ll have to see if I can get my hands on them.

3
What do you mean "SharePoint Directory" ("Document library", "folder in a document library", something else)?Alexei Levenkov

3 Answers

2
votes

I assume by "Directory" you mean SharepOInt Document Library Folders? Check out the SharePoint 2010 Client Side Object model. It has a full set of objects that can be used to perform SharePoint operations for a remote machine.

This MSDN posting talks about exactly how to create a folder with it.

2
votes

Using the good old WebRequest worked out

    private string SharePointSite
    {
        get { return @"https://Mysite.com/My Document Library"; }
    }

    private void button1_Click(object sender, RoutedEventArgs e)
    {
        for (int i = 1; i <= 10; i++)
        {
            CreateFolder("Test " + i.ToString());
        }
    }

    private bool CreateFolder(string FolderName)
    {
        string folderURL = SharePointSite + @"/" + FolderName;
        bool _Return = false;
        try
        {
            WebRequest request = WebRequest.Create(folderURL);
            request.Credentials = CredentialCache.DefaultCredentials;
            request.Method = "MKCOL";
            WebResponse response = request.GetResponse();
            response.Close();
            _Return = true;
        }
        catch (WebException)
        {
            _Return = false;
        }

        Console.WriteLine("{0} Created {1}", FolderName, _Return);
        return _Return;
    }
1
votes

Short answer, you must install SharePoint 2010 in order to write code agains the Client Object Model.

Long answer, You will have to set up a 64 bit environment (of some kind) to install SharePoint 2010, so your Visual Studio can gain access to the Client Object Model references: Getting Started with the Client Object Model

It might be possible to just grab those DLLs and reference them in Visual Studio, but using them may still require a 64bit OS.