コード例 #1
0
ファイル: SPHelper.cs プロジェクト: zhoutaomtv/ca
        public static IList<string> GetImportExceptionsFromSPList(SPWeb web, string listName)
        {
            web.AssertNotNull("web");
            listName.AssertNotNull("listName");

            try
            {
                var list = new List<string>();

                var exceptions = web.Lists[listName];

                list.AddRange(from SPListItem item in exceptions.Items select item["Title"].ToString().Trim());

                return list;
            }
            catch (Exception ex)
            {
                throw new SPException(String.Format("List [{1}] does not exist in the site [{0}] or user has no access to the list.", web.Url, listName), ex);
            }
        }