Sharepoint对象模型应用程序无法在WSS服务器之外运行

val*_*val 0 sharepoint

我在Windows Server 2003上使用Microsoft.SharePoint对象模型VS WSS扩展创建了一个C#控制台应用程序.该应用程序应该迭代WSS3.0站点以查找所有可用列表.它在服务器上运行得很好.但是,如果我尝试从网络上的另一台计算机运行exe,应用程序立即崩溃在SPSite siteCollection = new SPSite(" http:// devsharepoint);甚至我的try和catch也没有帮助,因为catch没有被执行.

是否仅在安装了VS SharePoint扩展的计算机上运行Sharepoint对象模型应用程序?

这是代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.SharePoint;

namespace ConsoleApplicationWSSobjectModel
{
    class Program
    {
        static void Main(string[] args)
        {
            string url = "http://sharepoint";
            Console.WriteLine("Trying to access: " + url);
            try
            {

                SPSite siteCollection = new SPSite(url);//"http://Server_Name");
                SPWebCollection sites = siteCollection.AllWebs;

                foreach (SPWeb site in sites)
                {
                    SPListCollection lists = site.Lists;

                    Console.WriteLine("Site: " + site.Name + "  Lists: " + lists.Count.ToString());
                }

                Console.WriteLine("Press ENTER to continue");
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

        }
    }
}
Run Code Online (Sandbox Code Playgroud)

小智 9

您不能使用SP对象模型"外部共享点",您将不得不使用Web服务(或者如果您使用sharepoint 2010,则可以使用新的客户端对象模型)