private static void AddDocumentTemplates(SPWeb _root, string templateUrl, string _strListName) { SPDocumentLibrary _list = (SPDocumentLibrary)_root.Lists[_strListName]; _list.DocumentTemplateUrl = templateUrl; _list.Update(); }
public void CreateDocumentLibrary(string nameDocumentLibrary, string title, string description, bool quickLaunch, bool enableVersioning = false) { using (SPSite site = new SPSite(_URL)) { using (SPWeb web = site.OpenWeb()) { //Check to see if list already exists try { SPDocumentLibrary targetList = web.Lists[nameDocumentLibrary] as SPDocumentLibrary; } catch (Exception) { Guid newListId = web.Lists.Add( title, // List Title description, // List Description SPListTemplateType.DocumentLibrary // List Template //docTemplate // Document Template (i.e. Excel) ); SPDocumentLibrary newLibrary = web.Lists[newListId] as SPDocumentLibrary; newLibrary.OnQuickLaunch = quickLaunch; newLibrary.EnableVersioning = enableVersioning; newLibrary.Update(); } finally { CreateSiteColumns(); } } } }
/// <summary> /// Adds the specified bytes to the EPM Live file store. /// </summary> /// <param name="content">The content.</param> /// <param name="fileExtension">The file extension.</param> public string Add(byte[] content, string fileExtension) { string fileName = Guid.NewGuid().ToString(); if (!string.IsNullOrEmpty(fileExtension)) { fileName += "." + fileExtension.Trim('.'); } _spWeb.AllowUnsafeUpdates = true; _spSite.AllowUnsafeUpdates = true; _fileStore.RootFolder.Files.Add(fileName, content); _fileStore.RootFolder.Update(); _fileStore.Update(); return(fileName); }
public void CreateDocumentLibrary(string nameDocumentLibrary, string title, string description, bool quickLaunch, bool enableVersioning = false) { using (SPWeb web = oSPSite.RootWeb) // will get the current web { //Check to see if list already exists try { SPDocumentLibrary targetList = oSPSite.RootWeb.Lists[nameDocumentLibrary] as SPDocumentLibrary; } catch (Exception) { Guid newListId = web.Lists.Add( title, // List Title description, // List Description SPListTemplateType.DocumentLibrary // List Template //docTemplate // Document Template (i.e. Excel) ); SPDocumentLibrary newLibrary = web.Lists[newListId] as SPDocumentLibrary; newLibrary.OnQuickLaunch = quickLaunch; newLibrary.EnableVersioning = enableVersioning; newLibrary.Update(); } } }
/// <summary> /// Write the directory tree of document library to a file of XML /// </summary> /// <param name="siteUrl">the url of site</param> /// <param name="libraryName">the name of document library</param> public void WriteXml(string siteUrl, string libraryName) { using (SPSite mysite = new SPSite(siteUrl)) { using (SPWeb myWeb = mysite.RootWeb) { //SPList myList = myWeb.Lists["Documents"]; SPFolder myFolder = myWeb.GetFolder(libraryName); //myFolder = myList.RootFolder; if (!myFolder.Exists) { SPListTemplate myListTemplate = myWeb.ListTemplates["Document Library"]; //SPDocTemplate myDocTemplate = (from SPDocTemplate dt in myWeb.DocTemplates where dt.Type == 122 select dt).FirstOrDefault(); //Guid myGuid = myWeb.Lists.Add(libraryName, String.Format("create document library named {0} successfully", libraryName), myListTemplate,myDocTemplate); Guid myGuid = myWeb.Lists.Add(libraryName, String.Format("create document library named {0} successfully", libraryName), myListTemplate); SPDocumentLibrary myLibrary = myWeb.Lists[myGuid] as SPDocumentLibrary; myLibrary.OnQuickLaunch = true; myLibrary.Update(); myFolder = myWeb.GetFolder(libraryName); Console.WriteLine("success"); } string changeStr = ChangeString(libraryName); XmlDocument myXmlDoc = new XmlDocument(); XmlDeclaration myXmlDeclaration = myXmlDoc.CreateXmlDeclaration("1.0", "utf-8", null); myXmlDoc.AppendChild(myXmlDeclaration); XmlElement addWeb = myXmlDoc.CreateElement("Web"); XmlElement addLibrary = myXmlDoc.CreateElement("Library"); XmlElement myXmlNode = myXmlDoc.CreateElement(changeStr); SPList list = myFolder.DocumentLibrary; foreach (SPField item in list.Fields) { if (!item.ReadOnlyField) { myXmlNode.SetAttribute(ChangeString(item.Title), item.Type.ToString()); } } addLibrary.AppendChild(GetSubNodeAllDirectory(myXmlNode, myFolder, myXmlDoc)); addWeb.AppendChild(addLibrary); myXmlDoc.AppendChild(addWeb); string sFilePath = "C:\\Users\\administrator.SPCARTOON\\Desktop\\XML"; string sFileName = "MySharePointXML2"; sFileName = sFilePath + @"\\" + sFileName; //文件的绝对路径 using (XmlTextWriter xmlTextWriter = new XmlTextWriter(@sFileName, Encoding.UTF8) { Formatting = Formatting.Indented, IndentChar = '\t', Indentation = 1 }) { myXmlDoc.Save(xmlTextWriter); Console.WriteLine("sss"); } } } }
private static void HandleDocumentLibrary(SPWeb web, bool ContentApproval, bool Versioning) { foreach (SPList list in web.Lists) { if (list.BaseTemplate == SPListTemplateType.DocumentLibrary) { SPDocumentLibrary doclib = list as SPDocumentLibrary; // Set "Content Approval" doclib.EnableModeration = ContentApproval; // Set "Versioning" doclib.EnableVersioning = Versioning; doclib.Update(); } } }
public void ReadXml(string siteUrl, string libraryName, string xmlPath) { using (SPSite mySite = new SPSite(siteUrl)) { using (SPWeb myWeb = mySite.RootWeb) { SPFolder myFolder = myWeb.GetFolder(libraryName); if (!myFolder.Exists) { SPListTemplate myListTemplate = myWeb.ListTemplates["Document Library"]; //SPDocTemplate myDocTemplate = (from SPDocTemplate dt in myWeb.DocTemplates where dt.Type == 122 select dt).FirstOrDefault(); //Guid myGuid = myWeb.Lists.Add(libraryName, String.Format("create document library named {0} successfully", libraryName), myListTemplate,myDocTemplate); Guid myGuid = myWeb.Lists.Add(libraryName, String.Format("create document library named {0} successfully", libraryName), myListTemplate); SPDocumentLibrary myLibrary = myWeb.Lists[myGuid] as SPDocumentLibrary; myLibrary.OnQuickLaunch = true; myLibrary.Update(); myFolder = myWeb.GetFolder(libraryName); Console.WriteLine("success"); } SPList myList = myFolder.DocumentLibrary; try { if (!IsExist(myList.Fields, "Source Path")) { string str1 = myList.Fields.Add("Source Path", SPFieldType.Text, false); //myList.Fields[str1].Description = "Oliver Content Type" + DateTime.Now.ToString(); myList.Update(); //myList = subFile.DocumentLibrary; Console.WriteLine("Source Path not exist,but create"); } } catch (Exception e) { WriteLog(e.Message); } XmlDocument myXmlDoc = new XmlDocument(); myXmlDoc.Load(xmlPath); string changeStr = "Web/Library/" + ChangeString(libraryName); XmlNode myXmlNode = myXmlDoc.SelectSingleNode(changeStr); AddFileToClient(myFolder, myXmlNode); } } }
// Set Content Types to Document Library public void SetContentTypesToDocumentLibrary(string nameDocumentLibrary, string nameGroupContentType) { using (SPWeb oSPWeb = oSPSite.RootWeb) { List <SPContentType> resultList = new List <SPContentType>(); SPContentTypeCollection allWebContentTypes = oSPWeb.ContentTypes; foreach (SPContentType contentType in allWebContentTypes) { if (contentType.Group == nameGroupContentType) { resultList.Add(contentType); } } SPDocumentLibrary library = oSPWeb.Lists[nameDocumentLibrary] as SPDocumentLibrary; library.ContentTypesEnabled = true; TryAddEachContentTypeToLibrary(library, resultList); library.Update(); } }
private static SPFolder GetOASLibrary(SPWeb web) { SPListTemplateType genericList = new SPListTemplateType(); genericList = SPListTemplateType.DocumentLibrary; SPFolder res = (SPFolder)web.GetFolder(OAS_LIBRARY); if (!res.Exists) { web.AllowUnsafeUpdates = true; Guid listGuid = web.Lists.Add(OAS_LIBRARY, "", genericList); SPDocumentLibrary oaslist = (SPDocumentLibrary)web.Lists[listGuid]; oaslist.Hidden = true; oaslist.Update(); } return((SPFolder)web.Folders[OAS_LIBRARY]); }
private void EnableAuditSettings(string site) { string auditLogLib = "ForSiteAuditing"; string auditLogPath = "/" + auditLogLib + "/"; try { using (SPWeb webNew = new SPSite(site).OpenWeb()) { SPSite spSite = webNew.Site; Guid id = webNew.Lists.Add(auditLogLib, "For Auditing", SPListTemplateType.DocumentLibrary); SPList listdoc = webNew.Lists[id]; listdoc.OnQuickLaunch = false; listdoc.Hidden = true; listdoc.Update(); SPDocumentLibrary _MyDocLibrary = (SPDocumentLibrary)webNew.Lists[auditLogLib]; SPFolderCollection _MyFolders = webNew.Folders; string folderURL = spSite.Url + auditLogPath + "AuditReports"; _MyFolders.Add(folderURL); //"ttp://adfsaccount:2222/My%20Documents/" + txtUpload.Text + "/"); _MyDocLibrary.Update(); spSite.TrimAuditLog = true; spSite.AuditLogTrimmingRetention = 90; Microsoft.Office.RecordsManagement.Reporting.AuditLogTrimmingReportCallout.SetAuditReportStorageLocation(spSite, folderURL); //AuditLogTrimmingReportCallout.SetAuditReportStorageLocation // Audi spSite.Audit.AuditFlags = SPAuditMaskType.Delete | SPAuditMaskType.Update | SPAuditMaskType.SecurityChange | SPAuditMaskType.SecurityChange | SPAuditMaskType.SchemaChange | SPAuditMaskType.Search; // site.Audit.AuditFlags =(Microsoft.SharePoint.SPAuditMaskType)auditOptions; spSite.Audit.Update(); } } catch { } }
public static SPFile UploadStream(SPDocumentLibrary library, Stream stream, string fileName) { library.RequireNotNull("library"); stream.RequireNotNull("stream"); fileName.RequireNotNullOrEmpty("fileName"); SPFolder rootFolder = library.RootFolder; SPFile spFile = rootFolder.Files.Add(fileName, stream); library.Update(); return spFile; }
public static void Main(string [] args) { AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); try { string userName, dirPath = null, fileName, imgUrl; byte [] data = null; int pos; bool hasData; SPDocumentLibrary lib = null; ServerContext sc = null; UserProfileManager man = null; UserProfile user = null; IEnumerator userEnum = null; DirectoryEntry entry = null; DirectorySearcher search = null; SearchResult result = null; PropertyValueCollection prop = null; ResultPropertyValueCollection rprop = null; SPFile spf; Predicate <IEnumerator> hasNext = delegate(IEnumerator o) { bool b; user = null; try { if (b = o.MoveNext()) { user = o.Current as UserProfile; } return(b); } catch (Exception ex) { Console.WriteLine("\r\n" + ex + "\r\n"); return(false); } }; using (SPSite site = new SPSite(cfg.ImportPath)) using (SPWeb web = site.OpenWeb()) { if ((pos = cfg.ImportPath.IndexOf("/_layouts/images/", StringComparison.InvariantCultureIgnoreCase)) > 0) { dirPath = Path.Combine(@"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\IMAGES", cfg.ImportPath.Substring(pos + "/_layouts/images/".Length).Replace("/", "\\")); } else if ((pos = cfg.ImportPath.IndexOf("/_layouts/", StringComparison.InvariantCultureIgnoreCase)) > 0) { dirPath = Path.Combine(@"C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS", cfg.ImportPath.Substring(pos + "/_layouts/images/".Length).Replace("/", "\\")); } else { try { if ((lib = web.GetList(cfg.ImportPath) as SPDocumentLibrary) == null) { throw new Exception(res.NoLib + " " + cfg.ImportPath); } } catch (Exception ex) { Console.WriteLine("\r\n" + ex + "\r\n"); } } if ((lib != null) || ((dirPath != null) && Directory.Exists(dirPath))) { try { if ((sc = ServerContext.GetContext(site)) == null) { throw new Exception("ServerContext.GetContext"); } } catch (Exception ex) { Console.WriteLine(res.InitErr, typeof(ServerContext).Name); Console.WriteLine("\r\n" + ex + "\r\n"); } } if (sc != null) { try { man = new UserProfileManager(sc, cfg.SSPIgnorePrivacy, cfg.SSPBackwardCompatible); if ((userEnum = man.GetEnumerator()) == null) { throw new Exception("UserProfileManager.GetEnumerator"); } } catch (Exception ex) { Console.WriteLine(res.InitErr, typeof(UserProfileManager).Name); Console.WriteLine("\r\n" + ex + "\r\n"); } if ((man != null) && (userEnum != null)) { while (hasNext(userEnum)) { if (user != null) { try { Console.WriteLine("=== " + (userName = user [cfg.SSPNameProp] + string.Empty).ToUpperInvariant() + " ==="); if (!DUMMY) { if (string.IsNullOrEmpty(cfg.ConnSearch)) { try { entry = NewDirectoryEntry(cfg.Conn.Replace("$USERNAME$", userName), cfg.ConnUser, cfg.ConnPass, cfg.ConnAuth); } catch (Exception ex) { Console.WriteLine(res.InitErr, typeof(DirectoryEntry).Name); Console.WriteLine("\r\n" + ex + "\r\n"); } } else { try { entry = NewDirectoryEntry(cfg.Conn, cfg.ConnUser, cfg.ConnPass, cfg.ConnAuth); search = new DirectorySearcher(entry); search.Filter = cfg.ConnSearch.Replace("$USERNAME$", userName); if ((result = search.FindOne()) == null) { throw new Exception("DirectorySearcher.FindOne"); } } catch (Exception ex) { Console.WriteLine(res.InitErr, typeof(SearchResult).Name); Console.WriteLine("\r\n" + ex + "\r\n"); } } } if (((result != null) && (result.Properties == null)) || ((result == null) && (entry != null) && (entry.Properties == null))) { Console.WriteLine(res.InitErr, typeof(System.DirectoryServices.PropertyCollection).Name); } else if (DUMMY || ((entry != null) && (entry.Properties != null)) || ((result != null) && (result.Properties != null))) { rprop = null; prop = null; data = null; if (!DUMMY) { try { if ((result != null) && (result.Properties != null)) { rprop = result.Properties [cfg.ConnProp]; } if ((entry != null) && (entry.Properties != null)) { prop = entry.Properties [cfg.ConnProp]; } if ((rprop == null) && (prop == null)) { throw new Exception((result != null) ? "SearchResult.Properties" : "DirectoryEntry.Properties"); } } catch (Exception ex) { Console.WriteLine(res.InitErr, typeof(PropertyValueCollection).Name); Console.WriteLine("\r\n" + ex + "\r\n"); } } hasData = true; if ((prop != null) || (rprop != null) || DUMMY) { if ((rprop != null) && ((rprop.Count == 0) || ((data = rprop [0] as byte []) == null))) { hasData = false; Console.WriteLine("Picture data is " + ((rprop.Count == 0) ? "empty" : ((rprop [0] == null) ? "null" : rprop [0].GetType().FullName))); } if (hasData && (data.Length == 0) && (prop != null) && ((data = prop.Value as byte []) == null)) { hasData = false; Console.WriteLine("Picture data is " + ((prop.Value == null) ? "null" : prop.Value.GetType().FullName)); } if (DUMMY) { using (FileStream fs = File.OpenRead(dummyCopyPath)) { data = new byte [fs.Length]; fs.Read(data, 0, data.Length); } } try { fileName = userName.ToLowerInvariant() + cfg.ImportExt; foreach (char c in FORBIDDEN_CHARS) { fileName = fileName.Replace(c, '_'); } imgUrl = cfg.ImportPath.TrimEnd('/') + '/' + fileName; if (hasData) { Console.WriteLine(res.Saving, imgUrl); if (lib != null) { spf = lib.RootFolder.Files.Add(fileName, data, true); imgUrl = web.Url.TrimEnd('/') + '/' + spf.Url.TrimStart('/'); } else { using (FileStream fs = File.Create(Path.Combine(dirPath, fileName))) { fs.Write(data, 0, data.Length); fs.Flush(); fs.Close(); } } Console.WriteLine(res.Setting, imgUrl); user [cfg.SSPProp].Value = imgUrl; } else if (cfg.ClearEmpty) { Console.WriteLine(res.Removing, imgUrl); try { if (lib != null) { lib.RootFolder.Files.Delete(fileName); } else if (File.Exists(Path.Combine(dirPath, fileName))) { File.Delete(Path.Combine(dirPath, fileName)); } } catch { } Console.WriteLine(res.Setting, imgUrl); user [cfg.SSPProp].Value = String.Empty; } user.Commit(); } catch (Exception ex) { Console.WriteLine("\r\n" + ex + "\r\n"); } } } } finally { if (search != null) { search.Dispose(); search = null; } } } } if (lib != null) { lib.Update(); } } } } Console.WriteLine(res.Done); if (Environment.UserInteractive) { Console.ReadLine(); } } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine(ex.StackTrace); throw ex; } }
private void btnAddCt_Click(object sender, EventArgs e) { try { //TODO: add validate button SPContentType newCT = ((ContentTypeHolder)cboRootContentTypes.SelectedItem).CT; RichTextBox rtb = ActionMetadata.DefInstance.rtbDisplay; rtb.Clear(); AddToRtbLocal("Adding Content Type to Document Library " + m_docLib.Title + "...\r\n", StyleType.titleSeagreen); //-- if (!m_docLib.ContentTypesEnabled) { m_docLib.ContentTypesEnabled = true; m_docLib.Update(); AddToRtbLocal("Content Type management enabled for " + m_docLib.Title + "\r\n", StyleType.bodySeaGreen); } //-- bool found = false; foreach (SPContentType ct in m_docLib.ContentTypes) { if (ct.Name == newCT.Name) { found = true; } } if (!found) { m_docLib.ContentTypes.Add(newCT); AddToRtbLocal("Content Type " + newCT.Name + " added to " + m_docLib.Title + "\r\n", StyleType.bodySeaGreen); } else { AddToRtbLocal("Content Type " + newCT.Name + " was already previously added to " + m_docLib.Title + "\r\n", StyleType.bodyChocolate); } GlobalVars.SETTINGS.metadata_defaultContentTypeForApplyCT = newCT.Group + " - " + newCT.Name; //-- if (chkChangeAllDocumentsToContentType.Checked) { int counter = 0; AddToRtbLocal("Changing all documents in library to new ContentType\r\n", StyleType.bodyBlack); FrmCancelRunning.ToggleEnabled(true); //ActionMetadata.DefInstance.toggleEnabled(true); for (int i = 0; i <= m_docLib.Items.Count - 1; i++) { if (GlobalVars.CancelRunning) { throw new Eh.CancelException(); } SPListItem listitem = m_docLib.Items[i]; SPContentTypeId currentContentTypeId = (SPContentTypeId)listitem["ContentTypeId"]; if (!currentContentTypeId.IsChildOf(newCT.Id)) { listitem["ContentTypeId"] = newCT.Id; listitem.Update(); counter++; AddToRtbLocal(listitem.File.Name, StyleType.bodySeaGreen); AddToRtbLocal(" ContentType-> " + newCT.Name + "\r\n", StyleType.bodyBlack); SmartStepUtil.ScrollToBottom(rtb); Application.DoEvents(); } } AddToRtbLocal("STATS: changed ContentType for " + counter + " documents, " + " total items in library: " + m_docLib.Items.Count + "\r\n", StyleType.bodyDarkGray); } SmartStepUtil.AddToRTB(rtb, "Done\r\n", Color.Black, 10, true); //-- this.Close(); } catch (Eh.CancelException) { AddToRtbLocal("canceled by user\r\n", StyleType.bodyBlackBold); } catch (Exception ex) { Eh.GlobalErrorHandler(ex); } finally { //ActionMetadata.DefInstance.toggleEnabled(false); FrmCancelRunning.ToggleEnabled(false); } }
protected override long SaveDocument(string LocalFilePath, DocumentStorage Storage, DocumentStorageArea StorageArea, Document Document, BindingList <DocumentAttributeValue> attributeValue) { SPSite site = null; SPWeb web = null; byte[] data = null; SPFile fileUploaded = null; string RootLibraryName = String.Empty; SPDocumentLibrary doclib = null; //Pick up the file in binary stream data = Document.Content.Blob; using (site = new SPSite(Storage.MainPath)) { using (web = site.OpenWeb()) { web.AllowUnsafeUpdates = true; //SPFolder Folder = web.GetFolder(StorageArea.Path); doclib = web.Lists[Storage.Name] as SPDocumentLibrary; if (doclib == null) { web.Lists.Add(Storage.Name, string.Empty, SPListTemplateType.DocumentLibrary); } /// **REMOVE**: 20090818 /// viene impostato l'override, altrimenti il documento resterebbe nel transito /// TODO : da sistemare con la gestione delle versioni in sharepoint try { SPFolder foolder = null; if (data != null) { if (!string.IsNullOrEmpty(StorageArea.Path)) { try { if (doclib.RootFolder.SubFolders[StorageArea.Path] == null) { doclib.RootFolder.SubFolders.Add(StorageArea.Path); } } catch (Exception) { doclib.RootFolder.SubFolders.Add(StorageArea.Path); } foolder = doclib.RootFolder.SubFolders[StorageArea.Path]; } else { foolder = doclib.RootFolder; } string fileName = GetIdDocuemnt(Document) + Path.GetExtension(Document.Name); try { fileUploaded = foolder.Files[fileName]; } catch { } if (fileUploaded != null) { fileUploaded.CheckOut(); fileUploaded.SaveBinary(data); fileUploaded.CheckIn("BiblosDS", SPCheckinType.MajorCheckIn); } else { fileUploaded = foolder.Files.Add(fileName, data, true); } //Set the file version Document.StorageVersion = fileUploaded.MajorVersion; if (ConfigurationManager.AppSettings["ForceSharePointSecurity"] != null && ConfigurationManager.AppSettings["ForceSharePointSecurity"].ToString().Equals("true", StringComparison.InvariantCultureIgnoreCase)) { fileUploaded.Item.BreakRoleInheritance(false); try { for (int i = 0; i < fileUploaded.Item.RoleAssignments.Count; i++) { try { fileUploaded.Item.RoleAssignments.Remove((SPPrincipal)fileUploaded.Item.RoleAssignments[i].Member); } catch (Exception) { } // } string SiteGroupsName = ConfigurationManager.AppSettings["SiteGroupsName"] == null ? string.Empty : ConfigurationManager.AppSettings["SiteGroupsName"].ToString(); //foreach (var item in Document.Permissions) //{ SPRoleDefinitionCollection webroledefinition = web.RoleDefinitions; SPGroup group = null; try { group = web.SiteGroups[SiteGroupsName]; } catch (Exception) { web.SiteGroups.Add(SiteGroupsName, web.AssociatedOwnerGroup, null, ""); group = web.SiteGroups[SiteGroupsName]; } //Add user to the group of viewer //try //{ // group.AddUser() //} //catch (Exception) //{ // throw; //} SPRoleAssignment assignment = new SPRoleAssignment(group); assignment.RoleDefinitionBindings.Add(webroledefinition.GetByType(SPRoleType.Reader)); fileUploaded.Item.RoleAssignments.Add(assignment); //} } catch (Exception) { } finally { fileUploaded.Item.BreakRoleInheritance(true); } } //In questo caso forse conviene salvare gli attributi al momento dell'upload del file. //SPListItem MyListItem = fileUploaded.Item; foreach (var item in Document.AttributeValues) { try { fileUploaded.Item[item.Attribute.Name] = item.Value; } catch (Exception) { doclib.Fields.Add(item.Attribute.Name, ParseSPFieldType(item.Attribute.AttributeType), item.Attribute.IsRequired); doclib.Update(); } } fileUploaded.Item.SystemUpdate(); } } catch (Exception ex) { //Write the log Logging.WriteLogEvent(BiblosDS.Library.Common.Enums.LoggingSource.BiblosDS_Sharepoint, "SaveDocument", ex.ToString(), BiblosDS.Library.Common.Enums.LoggingOperationType.BiblosDS_General, BiblosDS.Library.Common.Enums.LoggingLevel.BiblosDS_Errors); throw new FileNotUploaded_Exception("File not uploaded" + Environment.NewLine + ex.ToString()); } web.AllowUnsafeUpdates = false; } } return(data.Length); }