KimhillZhang  

sharepoint 07版不会出现这问题是,可10版的出现了,弄了半天不知道错在哪里,上网上了结果搜到答案了,贴出来看看:

这是由于生成的项目的目标平台没有改成X64位所引起的。(原本是X86)

源码:

           SPSite oSite = new SPSite("http://win-02n8aoiofb5/Team/");
            SPWeb oWeb = oSite.OpenWeb();
            SPList oList = oWeb.Lists["TeamTable"];
            for (int i = 1; i <= oList.Items.Count; i++)
            {
                SPListItem oListItem = oList.Items.GetItemById(i);
                this.listBox1.Items.Add(oListItem["名字"].ToString());
            }

posted on 2012-02-29 20:24  KimhillZhang  阅读(1016)  评论(1编辑  收藏  举报