コード例 #1
0
        /// <summary>
        /// 获取指定列表库的所有列表项
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="ListName">列表库名称</param>
        /// <returns></returns>
        public SPListItems GetSPListItems(SPSetting setting, string ListName)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);
            SPListItems      items     = docHelper.GetSPListItems(ListName);

            return(items);
        }
コード例 #2
0
        public SPWcfDocument GetFolderDocumentTest(SPSetting setting, string ListName, int iFolderId)
        {
            SharePointHelper     docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);
            SPCostDocuments      docs      = docHelper.GetFolderDocuments(ListName, iFolderId);
            List <SPWcfDocument> wcfDocs   = new List <SPWcfDocument>();

            foreach (SPCostDocument doc in docs)
            {
                SPWcfDocument wcfDoc = new SPDocumentWcfService.SPWcfDocument()
                {
                    ID             = doc.ID,
                    UniqueId       = doc.UniqueId,
                    FileLeafRef    = doc.FileLeafRef,
                    FileRef        = doc.FileRef,
                    DocIcon        = doc.DocIcon,
                    DelFileFullRef = doc.DelFileFullRef,
                    FileFullRef    = doc.FileFullRef,
                    FileWebFullRef = doc.FileWebFullRef,
                    PageNum        = doc.PageNum,
                    DocumentType   = doc.DocumentType,
                    CreateUser     = doc.CreateUser,
                    Created        = doc.Created,
                    ModifieUser    = doc.ModifieUser,
                    FileLeafName   = doc.FileLeafName,
                    FileUrl        = doc.FileFullRef,
                    FileName       = doc.FileLeafRef
                };
                wcfDocs.Add(wcfDoc);
            }
            return(wcfDocs[0]);
        }
コード例 #3
0
        /// <summary>
        /// 上传文件到指定的文件夹里面
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="strFileName">文件名称</param>
        /// <param name="fileData">文件内容</param>
        /// <param name="ListName">文档库名称</param>
        /// <param name="FolderId">文件夹编号</param>
        /// <param name="IsUpload">文件上传是否成功</param>
        /// <returns></returns>
        public string UploadFile(SPSetting setting, string strFileName, byte[] fileData, string ListName, int FolderId, out bool IsUpload)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);
            string           strReturn = docHelper.UploadFile(strFileName, fileData, ListName, FolderId, out IsUpload);

            return(strReturn);
        }
コード例 #4
0
        /// <summary>
        /// 获取指定列表库按条件查询和排序的列表项
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="ListName">列表库名称</param>
        /// <param name="SearchList">查询条件(key:字段名/value:字段内容)</param>
        /// <param name="OrderList">需要排序的字段组合(key:字段名/value:排序顺序:True=Asc|False=Desc)</param>
        /// <returns></returns>
        public SPListItems GetSPListItemsBySearchOrder(SPSetting setting, string ListName, SPListSearchs SearchList, Dictionary <string, SPListOrderByEnum> OrderList)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);
            SPListItems      items     = docHelper.GetSPListItems(ListName, SearchList, OrderList);

            return(items);
        }
コード例 #5
0
        /// <summary>
        /// 获取指定文件的数据流
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="strWebUrl">文件完整地址</param>
        /// <param name="strListName">所在文档库</param>
        /// <returns></returns>
        public byte[] GetWebFileStream(SPSetting setting, string strWebUrl, string strListName)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);

            byte[] fileContents = docHelper.GetWebFileStream(strWebUrl, strListName);
            return(fileContents);
        }
コード例 #6
0
        /// <summary>
        /// 上传文件到指定的文件夹里面(新建文件夹)
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="strFileName">文件名称</param>
        /// <param name="fileData">文件内容</param>
        /// <param name="ListName">文档库名称</param>
        /// <param name="FolderName">文件夹名称</param>
        /// <param name="iPageNum">扩展属性页数</param>
        /// <param name="strDocumentType">附件类型</param>
        /// <param name="IsUpload">文件上传是否成功</param>
        /// <param name="strUploadMessage">文件上传的返回信息</param>
        /// <returns>新文件夹编号</returns>
        public int UploadFile(SPSetting setting, string strFileName, byte[] fileData, string ListName, string FolderName, int iPageNum, string strDocumentType, out bool IsUpload, out string strUploadMessage)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);
            int iFolderId = docHelper.UploadFile(strFileName, fileData, ListName, FolderName, iPageNum, strDocumentType, out IsUpload, out strUploadMessage);

            return(iFolderId);
        }
コード例 #7
0
        public string UploadFileTest(FileUploadMessage upfile)
        {
            bool             IsUpload  = false;
            SPSetting        setting   = upfile.Setting;
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);

            //long fileLength = upfile.fileData.Length;
            byte[] fileContents = upfile.fileData;;

            string strReturn = docHelper.UploadFile(upfile.FileName, fileContents, upfile.ListName, out IsUpload);

            return(strReturn);
        }
コード例 #8
0
        /// <summary>
        /// 获取指定文档库里面的所有文件集合
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="ListName">文档库名称</param>
        /// <returns></returns>
        public List <SPWcfDocument> GetFolderAllDocuments(SPSetting setting, string ListName)
        {
            SharePointHelper     docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);
            SPCostDocuments      docs      = docHelper.GetFolderDocuments(ListName);
            List <SPWcfDocument> wcfDocs   = new List <SPWcfDocument>();

            foreach (SPCostDocument doc in docs)
            {
                SPWcfDocument wcfDoc = SPDocToWcfDoc(doc);
                wcfDocs.Add(wcfDoc);
            }
            return(wcfDocs);
        }
コード例 #9
0
        /// <summary>
        /// 创建文件夹
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="strListName">文档库</param>
        /// <param name="strFolderName">文件夹名称</param>
        /// <param name="dtCreated">日期</param>
        /// <returns></returns>
        public SPWcfFolder CreateSPFolder(SPSetting setting, string strListName, string strFolderName, DateTime dtCreated)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);
            SPCostFolder     folder    = docHelper.CreateSPFolder(strListName, strFolderName, dtCreated);
            SPWcfFolder      wFolder   = new SPDocumentWcfService.SPWcfFolder()
            {
                ID          = folder.ID,
                FileRef     = folder.FileRef,
                FileLeafRef = folder.FileLeafRef,
                FileFullRef = folder.FileFullRef,
                ListName    = folder.ListName,
                ParentUrl   = folder.ParentUrl,
                UniqueId    = folder.UniqueId
            };

            return(wFolder);
        }
コード例 #10
0
        /// <summary>
        /// 更新列表库指定列表项字段内容
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="strListName">列表库名称</param>
        /// <param name="iItemId">更改数据的编号</param>
        /// <param name="updateValue">需要更改的内容</param>
        public void UpdateSPListItem(SPSetting setting, string strListName, int iItemId, Dictionary <string, string> updateValue)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);

            docHelper.UpdateSPListItem(strListName, 1, updateValue);
        }
コード例 #11
0
 /// <summary>
 /// 获取指定列表库按条件查询的列表项
 /// </summary>
 /// <param name="setting">配置信息</param>
 /// <param name="ListName">列表库名称</param>
 /// <param name="SearchList">查询条件(key:字段名/value:字段内容)</param>
 /// <returns></returns>
 public SPListItems GetSPListItemsBySearch(SPSetting setting, string ListName, Dictionary <string, string> SearchList)
 {
     throw new NotImplementedException();
 }
コード例 #12
0
        /// <summary>
        /// 删除指定文件夹里面的图片文件
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="ListName">图片库名称</param>
        /// <param name="ImageFileName">图片文件名</param>
        /// <param name="iFolderId">文件夹编号</param>
        /// <returns></returns>
        public bool DeleteImageFile(SPSetting setting, string ListName, string ImageFileName, int iFolderId)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);

            return(docHelper.DeleteImageFile(ListName, ImageFileName, iFolderId));
        }
コード例 #13
0
        /// <summary>
        /// 按查询条件和排序规则查询图片库图片集合
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="strListName">图片库名称</param>
        /// <param name="SearchList">查询条件</param>
        /// <param name="OrderList">排序条件</param>
        /// <returns></returns>
        public SPImages GetImageFilesBySearchOrder(SPSetting setting, string strListName, SPListSearchs SearchList, Dictionary <string, SPListOrderByEnum> OrderList)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);

            return(docHelper.GetImageFiles(strListName, SearchList, OrderList));
        }
コード例 #14
0
        /// <summary>
        /// 获取图片库里面的指定图片
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="strFileName">图片名称</param>
        /// <param name="strListName">图片库名称</param>
        /// <param name="iFolderId">存放文件夹编号</param>
        /// <returns></returns>
        public SPImage GetImageFolderFile(SPSetting setting, string strFileName, string strListName, int iFolderId)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);

            return(docHelper.GetImageFolderFile(strFileName, strListName, iFolderId));
        }
コード例 #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="setting">配置信息</param>
        /// <param name="strListName">图片库名称</param>
        /// <param name="iFolderId">文件夹编号</param>
        /// <param name="strNewFolderName">文件夹新名称</param>
        /// <returns></returns>
        public bool UpdateImageFolderName(SPSetting setting, string strListName, int iFolderId, string strNewFolderName)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);

            return(docHelper.UpdateImageFolderName(strListName, iFolderId, strNewFolderName));
        }
コード例 #16
0
 public SPListFields GetTest1(SPSetting setting)
 {
     return(new SPDocumentWcfService.SPListFields());
 }
コード例 #17
0
        public SPCostFolders GetListFolders(SPSetting setting, string ListName)
        {
            SharePointHelper docHelper = new SPDocumentWcfService.SharePointHelper(setting.SPUserId, setting.SPUserPwd, setting.SPUserDomain, setting.SPSite, setting.SPWeb, setting.ActionUser);

            return(docHelper.GetListFolders(ListName));
        }