Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new folder under the current folder structure
        /// using the Document Workspace Web Service.
        /// </summary>
        /// <param name="folderName"></param>
        public SharePointDocLibFolder CreateFolder(string folderName)
        {
            SharePointDocLibFolder newFolder = null;
            Dws dws = NewDwsWebService();

            try
            {
                string newFolderName = libPath + "/" + folderName;
                string strResult     = dws.CreateFolder(newFolderName);
                if (IsDwsErrorResult(strResult))
                {
                    // Simple solution just to write out
                    // the message to the console. You may
                    // want to parse this and act accordingly
                    Console.WriteLine(strResult);
                }
                else
                {
                    newFolder             = new SharePointDocLibFolder(siteUrl, newFolderName);
                    newFolder.Credentials = Credentials;
                    folderList.Add(newFolder);
                    return(newFolder);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(newFolder);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// News the DWS web service.
        /// </summary>
        /// <returns></returns>
        public Dws NewDwsWebService()
        {
            Dws ws = new Dws();

            ws.Url         = siteUrl + "Dws.asmx";
            ws.Credentials = Credentials;
            return(ws);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Deletes this folder from SharePoint using the dws web service.
        /// </summary>
        public void Delete()
        {
            Dws dws = NewDwsWebService();

            try
            {
                dws.DeleteFolder(folderUrl);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }