简体   繁体   English

在未安装Sharepoint的情况下在VS 2010中创建Sharepoint目录

[英]Creating Sharepoint Directories in VS 2010 Without Sharepoint installed

I have a Winform App that is currently in production. 我有一个正在生产的Winform App。 It runs several reports to PDF and puts them on a shared drive. 它可以将多个报告生成为PDF,并将它们放在共享驱动器上。 In this process it creates several directories and places these PDF's in the proper Directory. 在此过程中,它将创建几个目录,并将这些PDF放入适当的目录中。

I can copy the files to a SharePoint location, I just can't create the Directories. 我可以将文件复制到SharePoint位置,但不能创建目录。 How can I create a SharePoint Directory without having SharePoint installed on my machine? 如何在没有在计算机上安装SharePoint的情况下创建SharePoint目录? 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 我正在使用VS2010,根据我的阅读,我无法在计算机上安装SharePoint,因为我在32位操作系统上运行

EDIT: I'm still pretty new to SharePoint 2010 so I may not have the terms down yet. 编辑:我还是SharePoint 2010的新手,所以我可能还没有这些条款。 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. 当我在SharePoint上的那个DL中时,我可以单击页面顶部的“库”选项卡,然后转到“使用资源管理器打开”。打开资源管理器后,我可以右键单击并创建一个文件夹。 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. 因此,也许EtherDragon建议使用dll可能行得通,我必须看看是否可以使用它们。

I assume by "Directory" you mean SharepOInt Document Library Folders? 我假设“目录”是指SharepOInt文档库文件夹? Check out the SharePoint 2010 Client Side Object model . 签出SharePoint 2010 客户端对象模型 It has a full set of objects that can be used to perform SharePoint operations for a remote machine. 它具有一整套对象,可用于对远程计算机执行SharePoint操作。

This M SDN posting talks about exactly how to create a folder with it. M SDN上的这篇文章详细讨论了如何使用它创建文件夹。

Using the good old WebRequest worked out 使用好旧的WebRequest算出

    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;
    }

Short answer, you must install SharePoint 2010 in order to write code agains the Client Object Model. 简短的答案,您必须安装SharePoint 2010才能再次编写代码客户端对象模型。

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 长答案,您将必须设置一个64位环境(某种形式)以安装SharePoint 2010,以便您的Visual Studio可以访问客户端对象模型引用:客户端对象模型入门

It might be possible to just grab those DLLs and reference them in Visual Studio, but using them may still require a 64bit OS. 可能可以只获取这些DLL并在Visual Studio中引用它们,但是使用它们仍然可能需要64位OS。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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