public Document Update(Guid contentId, [Documentation(Name = "Fields", Description = "A collection of field names and values.", Type = typeof(IDictionary))] IDictionary options) { var document = new Document(); try { if (options["Fields"] is IDictionary) { document = PublicApi.Documents.Update(EnsureLibraryId(contentId), new DocumentUpdateOptions(contentId) { Fields = (IDictionary)options["Fields"] }); } } catch (InvalidOperationException ex) { document.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.InvalidUpdateOptions, contentId))); } catch (SPInternalException ex) { document.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.CannotBeUpdated, contentId))); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the WidgetApi.V2.SharePointFile.Update() method ContetnId:{1}. The exception message is: {2}", ex.GetType(), contentId, ex.Message); SPLog.UnKnownError(ex, message); document.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.UnknownError))); } return(document); }
public void ResetInheritance(PermissionsGetQuery options) { var spwebUrl = EnsureUrl(options.Url, options.ListId); try { using (var clientContext = new SPContext(spwebUrl, credentials.Get(spwebUrl))) { List splist = clientContext.Web.Lists.GetById(options.ListId); var splistItemCollection = splist.GetItems(options.Id.HasValue ? CAMLQueryBuilder.GetItem(options.Id.Value, new string[] { }) : CAMLQueryBuilder.GetItem(options.ContentId, new string[] { })); var lazyListItems = clientContext.LoadQuery(splistItemCollection.Include(item => item.HasUniqueRoleAssignments, item => item.Id)); clientContext.ExecuteQuery(); var splistItem = lazyListItems.First(); splistItem.ResetRoleInheritance(); clientContext.ExecuteQuery(); } } catch (Exception ex) { string itemId = options.Id.HasValue ? options.Id.Value.ToString(CultureInfo.InvariantCulture) : options.ContentId.ToString(); string message = string.Format("An exception of type {0} occurred in the SPPermissionsService.ResetInheritance() method for ListId: {1} ItemId: {2}. The exception message is: {3}", ex.GetType(), options.ListId, itemId, ex.Message); SPLog.RoleOperationUnavailable(ex, message); throw new SPInternalException(message, ex); } }
public Library Get(Guid libraryId) { var library = new Library(); try { library = PublicApi.Libraries.Get(new LibraryGetOptions(libraryId)); } catch (InvalidOperationException ex) { library.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointLibraryExtension.Translations.InvalidId, libraryId))); } catch (SPInternalException ex) { library.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointLibraryExtension.Translations.NotFound, libraryId))); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the WidgetApi.V2.SharePointLibrary.Get() method for LibraryId: {1}. The exception message is: {2}", ex.GetType(), libraryId, ex.Message); SPLog.UnKnownError(ex, message); library.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointLibraryExtension.Translations.UnknownError))); } return(library); }
public void Execute(JobData jobData) { foreach (var spprofileSyncProvider in ProfileSyncHelper.ProviderList()) { try { using (var syncService = new SPProfileSyncService(spprofileSyncProvider)) { if (!syncService.Enabled) { continue; } var incrementalProfileSyncManager = new IncrementalProfileSyncManager(syncService.Get <IIncrementalProfileSyncService>(), spprofileSyncProvider.Id); if (!incrementalProfileSyncManager.IsSyncEnabled) { continue; } using (new PerformanceProfiler(String.Format("Incremental Profile Sync Job for {0}.", spprofileSyncProvider.SPSiteURL))) { incrementalProfileSyncManager.Sync(); } } } catch (Exception ex) { SPLog.BackgroundJobError(ex, "Incremental Profile Sync Error. SPSite url: {0}", spprofileSyncProvider.SPSiteURL); } } }
public List <SPPermissionsLevel> Levels(string webUrl) { var levels = new List <SPPermissionsLevel>(); try { using (var clientContext = new SPContext(webUrl, credentials.Get(webUrl))) { var web = clientContext.Web; clientContext.Load(web, w => w.RoleDefinitions.Include( rd => rd.Id, rd => rd.Name, rd => rd.Description)); clientContext.ExecuteQuery(); foreach (var rd in web.RoleDefinitions) { levels.Add(new SPPermissionsLevel(rd.Id, rd.Name) { Description = rd.Description }); } } } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the SPPermissionsService.Levels() method for SPWebUrl: {1}. The exception message is: {2}", ex.GetType(), webUrl, ex.Message); SPLog.RoleOperationUnavailable(ex, message); throw new SPInternalException(message, ex); } return(levels); }
public int GetWSSId(string url, string label) { using (var context = new SPContext(url, credentials.Get(url))) { try { var taxonomyList = context.Web.Lists.GetByTitle("TaxonomyHiddenList"); var taxItems = taxonomyList.GetItems(CAMLQueryBuilder.GetItemByTitle(label, new[] { "Title", "ID" })); context.Load(taxItems); context.ExecuteQuery(); if (taxItems.Any()) { return(taxItems[0].Id); } } catch (Exception ex) { SPLog.UnKnownError(ex, ex.Message); } } return(-1); }
public Folder Get(string url, Guid libraryId, string folderPath) { Folder folder; try { using (var clientContext = new SPContext(url, credentials.Get(url))) { var spfolder = clientContext.Web.GetFolderByServerRelativeUrl(folderPath); clientContext.Load(spfolder, f => f.Name, f => f.ServerRelativeUrl, f => f.ItemCount); clientContext.ExecuteQuery(); folder = new Folder(spfolder.Name, spfolder.ServerRelativeUrl, spfolder.ItemCount, libraryId); } } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the InternalApi.SPFolderService.Get() method LibraryId: {1} ServerRelativeUrl: '{2}' SPWebUrl: '{3}'. The exception message is: {4}", ex.GetType(), libraryId, folderPath, url, ex.Message); SPLog.RoleOperationUnavailable(ex, message); throw new SPInternalException(message, ex); } return(folder); }
public void Delete(Guid id, bool deleteList) { var list = listDataService.Get(id); if (list == null) { return; } Validate(list); listDataService.Delete(list.Id); if (deleteList) { try { using (var clientContext = new SPContext(list.SPWebUrl, credentials.Get(list.SPWebUrl))) { var splist = clientContext.Web.Lists.GetById(list.Id); splist.DeleteObject(); clientContext.ExecuteQuery(); } } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the InternalApi.SPListService.Delete() method for ApplicationId: {1}. The exception message is: {2}", ex.GetType(), id, ex.Message); SPLog.RoleOperationUnavailable(ex, message); throw new SPInternalException(message, ex); } } }
public bool CanEdit(Guid listId) { var listBase = listDataService.Get(listId); if (listBase == null) { return(false); } Validate(listBase); try { bool?canEdit; using (var spcontext = new SPContext(listBase.SPWebUrl, credentials.Get(listBase.SPWebUrl))) { var splist = spcontext.Web.Lists.GetById(listId); spcontext.Load(splist, l => l.EffectiveBasePermissions); spcontext.ExecuteQuery(); canEdit = splist.EffectiveBasePermissions.Has(PermissionKind.EditListItems); } return(canEdit.Value); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the InternalApi.SPListService.CanEdit() method for ApplicationId: {1}. The exception message is: {2}", ex.GetType(), listId, ex.Message); SPLog.RoleOperationUnavailable(ex, message); throw new SPInternalException(message, ex); } }
public Folder Delete(string applicationId, string folderPath) { var folder = new Folder(); Guid libraryId; if (Guid.TryParse(applicationId, out libraryId)) { try { folder = ClientApi.Folders.Delete(libraryId, new FolderGetOptions(folderPath)); } catch (InvalidOperationException ex) { folder.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFolderExtension.Translations.InvalidLibraryId))); } catch (SPInternalException ex) { folder.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFolderExtension.Translations.NotFoundBecauseDeleted))); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the WidgetApi.V1.SharePointFolder.Delete() method for ApplicationId: {1} FolderPath: '{2}'. The exception message is: {3}", ex.GetType(), applicationId, folderPath, ex.Message); SPLog.UnKnownError(ex, message); folder.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFolderExtension.Translations.UnknownError))); } } else { folder.Errors.Add(new Error(typeof(InvalidOperationException).ToString(), plugin.Translate(SharePointFolderExtension.Translations.InvalidLibraryId, applicationId))); } return(folder); }
public List <string> LoadSubSiteUrls() { var webCollection = new List <string>(); using (var clientContext = new SPContext(siteUrl, auth, runAsServiceAccount: true)) { var webs = clientContext.Web.Webs; clientContext.Load(webs); try { clientContext.ExecuteQuery(); } catch (Exception ex) { SPLog.UnKnownError(ex, "An exception in the process of SiteCollection loading of type {0} has been occurred. The exception message is: {1}", ex.GetType().Name, ex.Message); return(webCollection); } var baseUrl = clientContext.Url.Trim('/'); foreach (var web in webs) { webCollection.Add(MergeUrl(baseUrl, web.ServerRelativeUrl)); } } return(webCollection); }
public AdditionalInfo Restore(Guid contentId, string version) { var restoreInfo = new AdditionalInfo(); try { PublicApi.Documents.Restore(EnsureLibraryId(contentId), new DocumentRestoreOptions(contentId) { Version = version }); } catch (InvalidOperationException ex) { restoreInfo.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.InvalidId, contentId))); } catch (SPInternalException ex) { restoreInfo.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.NotFound, contentId))); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the WidgetApi.V2.SharePointFile.Restore() method ContentId: {1} Version: {2}. The exception message is: {3}", ex.GetType(), contentId, version, ex.Message); SPLog.UnKnownError(ex, message); restoreInfo.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.UnknownError))); } return(restoreInfo); }
public PagedList <SPDocumentVersion> GetVersions(Guid contentId) { var documentVersions = new PagedList <SPDocumentVersion>(); try { documentVersions = new PagedList <SPDocumentVersion>(PublicApi.Documents.GetVersions(EnsureLibraryId(contentId), new DocumentGetOptions(contentId))); } catch (InvalidOperationException ex) { documentVersions.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.InvalidId, contentId))); } catch (SPInternalException ex) { documentVersions.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.NotFound, contentId))); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the WidgetApi.V2.SharePointFile.GetVersions() method ContentId: {1}. The exception message is: {2}", ex.GetType(), contentId, ex.Message); SPLog.UnKnownError(ex, message); documentVersions.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.UnknownError))); } return(documentVersions); }
public AdditionalInfo UndoCheckOut(Guid contentId) { var undoCheckOutInfo = new AdditionalInfo(); try { PublicApi.Documents.UndoCheckOut(EnsureLibraryId(contentId), new DocumentGetOptions(contentId)); } catch (InvalidOperationException ex) { undoCheckOutInfo.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.InvalidId, contentId))); } catch (SPInternalException ex) { undoCheckOutInfo.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.CannotBeCheckedIn, contentId))); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the WidgetApi.V2.SharePointFile.CheckOut() method ContentId: {1}. The exception message is: {2}", ex.GetType(), contentId, ex.Message); SPLog.UnKnownError(ex, message); undoCheckOutInfo.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.UnknownError))); } return(undoCheckOutInfo); }
public IEnumerable <FuelConsumptionAndEmission> GetDWHCustVenuConsTotal(string databaseName, string companyId, string customerId, string venueCode, DateTime beginDate, DateTime endDate) { if (databaseName == DataBases.NetsuiteInsphire) { throw new NotImplementedException(); } IEnumerable <FuelConsumptionAndEmission> returnData; SPLog splog = new SPLog("GetDWHCustVenuConsTotal", databaseName, customerId); try { returnData = _database().Query <FuelConsumptionAndEmission>( "web.GetDWHCustVenuConsTotal", new { company = companyId, customer = customerId, venue = venueCode, beginDate = beginDate.ToString("yyyy/MM/dd"), endDate = endDate.ToString("yyyy/MM/dd") }, commandType: CommandType.StoredProcedure); splog.Log(); return(returnData); } catch (Exception e) { splog.LogError(e.GetType().Name + " - " + e.Message); throw new Exception("See inner exception", e); } }
public PagedList <SPList> ListItemsToReindex(Guid typeId, int batchSize, string[] viewFields = null) { var lists = listDataService.ListsToReindex(typeId, batchSize); var spLists = new PagedList <SPList> { PageSize = lists.PageSize, PageIndex = lists.PageIndex, TotalCount = lists.TotalCount }; foreach (var list in lists) { try { var splist = Get(new ListGetQuery(list.Id, typeId)); if (splist != null) { spLists.Add(splist); } } catch (SPInternalException) { } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the InternalApi.SPListService.ListsToReindex() method for ApplicationTypeId: {1} BatchSize: {2}. The exception message is: {3}", ex.GetType(), typeId, batchSize, ex.Message); SPLog.RoleOperationUnavailable(ex, message); } } return(spLists); }
public async Task <IEnumerable <ContactPerson> > GetCustomerContacts(Customer customer) { if (customer.DatabaseName == DataBases.NetsuiteInsphire) { return(await Helpers.NetSuite.NetSuiteHelper.GetCustomerContacts(customer)); } IEnumerable <ContactPerson> returnData; SPLog splog = new SPLog("GetCustomerProjects", customer.DatabaseName, customer.CustomerId); try { returnData = _db.Query <ContactPerson>( "web.GetCustomerContacts" + customer.DatabaseName, new { company = customer.CompanyId, customer = customer.CustomerId }, commandType: CommandType.StoredProcedure); return(returnData); } catch (Exception e) { splog.LogError(e.GetType().Name + " - " + e.Message); throw new Exception("See inner exception", e); } }
public bool IsInherited(SPList list, SPListItem listItem) { var inheritance = new Inheritance(); Validate(inheritance.Errors, list, listItem); if (!inheritance.Errors.Any()) { var permissionsGetOptions = new PermissionsGetOptions(list.Id, listItem.ContentId) { Url = list.SPWebUrl }; try { inheritance = ClientApi.Permissions.GetInheritance(permissionsGetOptions); } catch (SPInternalException ex) { inheritance.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointPermissionsExtension.Translations.ListItemNotFound))); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the WidgetApi.V1.SharePointPermissions.Get() method for ContentId: {1} ListId: {2}. The exception message is: {3}", ex.GetType(), listItem.ContentId, list.Id, ex.Message); SPLog.UnKnownError(ex, message); inheritance.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointPermissionsExtension.Translations.UnknownError))); } } return(inheritance.Enabled); }
public void UpdateIndexingStatus(Guid[] ids, bool isIndexed) { if (ids == null || ids.Length <= 0) { return; } var applicationIds = string.Join(",", ids); try { using (var connection = DataHelpers.GetSqlConnection()) { using (var command = DataHelpers.CreateSprocCommand("[te_SharePoint_List_UpdateIsIndexed]", connection)) { connection.Open(); command.Parameters.Add("@IsIndexed", SqlDbType.Bit).Value = isIndexed ? 1 : 0; command.Parameters.Add("@ApplicationIds", SqlDbType.NVarChar).Value = applicationIds; command.ExecuteNonQuery(); connection.Close(); } } } catch (Exception ex) { var message = string.Format("An exception of type {0} occurred in the SPListDataService.ListsToReindex() method for Application Ids: {1}. The exception message is: {2}", ex.GetType(), applicationIds, ex.Message); SPLog.DataProvider(ex, message); throw new SPDataException(message, ex); } }
public void AddUserToGroup(string url, Authentication authentication, string loginNames, int groupId) { // Group Id is invalid if (groupId <= 0) { return; } using (var clientContext = new SPContext(url, authentication ?? credentials.Get(url))) { var group = clientContext.Web.SiteGroups.GetById(groupId); foreach (var loginName in loginNames.Split(',')) { var user = clientContext.Web.EnsureUser(loginName); group.Users.AddUser(user); } try { clientContext.ExecuteQuery(); } catch (ServerException ex) { //User not found SPLog.RoleOperationUnavailable(ex, String.Format("A server exception occurred while adding users to the group with id '{0}'. The exception message is: {1}", groupId, ex.Message)); } } }
public List <Folder> List(string url, Guid libraryId, string folderPath) { var folderList = new List <Folder>(); try { using (var clientContext = new SPContext(url, credentials.Get(url))) { var list = clientContext.Web.Lists.GetById(libraryId); var rootFolder = list.RootFolder; clientContext.Load(rootFolder, f => f.ServerRelativeUrl); var spfolder = clientContext.Web.GetFolderByServerRelativeUrl(folderPath); var folderCollection = clientContext.LoadQuery(SP.ClientObjectQueryableExtension.Include(spfolder.Folders, f => f.Name, f => f.ServerRelativeUrl, f => f.ItemCount)); clientContext.ExecuteQuery(); folderList.AddRange(from f in folderCollection where !IsHiddenFolder(f.ServerRelativeUrl, rootFolder.ServerRelativeUrl) select new Folder(f.Name, f.ServerRelativeUrl, f.ItemCount, libraryId)); } } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the InternalApi.SPFolderService.List() method LibraryId: {1} ServerRelativeUrl: '{2}' SPWebUrl: '{3}'. The exception message is: {4}", ex.GetType(), libraryId, folderPath, url, ex.Message); SPLog.RoleOperationUnavailable(ex, message); throw new SPInternalException(message, ex); } return(folderList); }
public static bool GetLastRunTime(int providerId, out DateTime?lastRunTime, out Status syncStatus) { lastRunTime = null; syncStatus = Status.Failed; const string spGetLastRunTime = "te_SharePoint_ProfileSync_GetLastRunTime"; try { var providerIdParam = new SqlParameter("@ProviderId", providerId); var lastRunTimeParam = new SqlParameter("@LastRunTime", System.Data.SqlDbType.DateTime) { Direction = System.Data.ParameterDirection.Output }; var syncStatusParam = new SqlParameter("@SyncStatus", System.Data.SqlDbType.Int) { Direction = System.Data.ParameterDirection.Output }; ExecuteScalar(spGetLastRunTime, GetConnection(), providerIdParam, lastRunTimeParam, syncStatusParam); lastRunTime = lastRunTimeParam.Value as DateTime?; syncStatus = (Status)syncStatusParam.Value; return(true); } catch (Exception ex) { SPLog.UserProfileUpdated(ex, string.Format("Profile Sync Error. {0}: {1}", spGetLastRunTime, providerId)); } return(false); }
public IntegrationProviders(String xml) : this() { if (String.IsNullOrEmpty(xml)) { return; } try { var doc = new XmlDocument(); doc.LoadXml(xml); var spObjectProviderListXml = doc[ProviderElement]; if (spObjectProviderListXml == null) { return; } foreach (XmlNode spObjectProviderXml in spObjectProviderListXml.ChildNodes) { IntegrationProvider spObjectProvider; if (IntegrationProvider.TryParse(spObjectProviderXml, out spObjectProvider)) { Collection.Add(spObjectProvider); } } } catch (Exception ex) { SPLog.DataProvider(ex, ex.Message); } }
public async Task <IEnumerable <Customer> > GetUserCustomers(string UserId) { // TODO: What if users have multiple customers belonging to a combination of different companies? //TODO Implement logic to get customer on customerID OR account number from InspHire // This will require changing the DB to account for the customer ID no longer being the primary key IEnumerable <Customer> returnData = null; if (Helpers.InspHire.DAL.TryGetUserCustomers(UserId, out returnData)) { return(returnData); } SPLog splog = new SPLog("GetAccountManagerDetailsSync"); try { returnData = await _database().QueryAsync <Customer>( "web.GetUserCustomers", new { userid = UserId }, commandType: CommandType.StoredProcedure); splog.Log(); return(returnData); } catch (Exception e) { splog.LogError(e.GetType().Name + " - " + e.Message); throw new Exception("See inner exception", e); } }
public SPPermissions Get(int userOrGroupId, PermissionsGetQuery options) { var spwebUrl = EnsureUrl(options.Url, options.ListId); try { using (var clientContext = new SPContext(spwebUrl, credentials.Get(spwebUrl))) { List splist = clientContext.Web.Lists.GetById(options.ListId); var splistItemCollection = splist.GetItems(options.Id.HasValue ? CAMLQueryBuilder.GetItem(options.Id.Value, new string[] { }) : CAMLQueryBuilder.GetItem(options.ContentId, new string[] { })); var listItemRoleAssignments = clientContext.LoadQuery( splistItemCollection.Select(item => item.RoleAssignments.GetByPrincipalId(userOrGroupId)).Include( roleAssignment => roleAssignment.Member, roleAssignment => roleAssignment.RoleDefinitionBindings.Include( roleDef => roleDef.Id, roleDef => roleDef.Name, roleDef => roleDef.Description))); clientContext.ExecuteQuery(); return(listItemRoleAssignments.First().ToPermission()); } } catch (Exception ex) { string itemId = options.Id.HasValue ? options.Id.Value.ToString(CultureInfo.InvariantCulture) : options.ContentId.ToString(); string message = string.Format("An exception of type {0} occurred in the SPPermissionsService.Get() method for a User or Group with Id: {1} ListId: {2} ItemId: {3}. The exception message is: {4}", ex.GetType(), userOrGroupId, options.ListId, itemId, ex.Message); SPLog.RoleOperationUnavailable(ex, message); throw new SPInternalException(message, ex); } }
public IEnumerable <RentalOrder> GetRentalOrdersChildBRSync(Customer customer, DateTime StartDate, DateTime EndDate) { if (customer.DatabaseName == DataBases.NetsuiteInsphire) { throw new NotImplementedException(); } IEnumerable <RentalOrder> returnData; SPLog splog = new SPLog("GetRentalOrdersChildBRSync", customer.DatabaseName, customer.CustomerId); try { returnData = _database().Query <RentalOrder>( "web.GetRentalOrdersChildBR" + customer.DatabaseName, new { company = customer.CompanyId, customer = customer.CustomerId, startdate = StartDate, enddate = EndDate }, commandType: CommandType.StoredProcedure); splog.Log(); return(returnData); } catch (Exception e) { splog.LogError(e.GetType().Name + " - " + e.Message); throw new Exception("See inner exception", e); } }
public async Task <IEnumerable <Invoice> > GetInvoicesInvoiceAccountChildBR(Customer customer, DateTime StartDate, DateTime EndDate) { if (customer.DatabaseName == DataBases.NetsuiteInsphire) { return(Helpers.InspHire.DAL.GetInvoicesInvoiceAccountChildBR(customer, StartDate, EndDate)); } IEnumerable <Invoice> returnData; SPLog splog = new SPLog("GetInvoicesInvoiceAccountChildBR", customer.DatabaseName, customer.CustomerId); try { returnData = await _database.QueryAsync <Invoice>("web.GetInvoicesInvoiceAccountChildBR" + customer.DatabaseName, new { company = customer.CompanyId, customer = customer.CustomerId, startdate = StartDate, enddate = EndDate }, commandType : CommandType.StoredProcedure); splog.Log(); return(returnData); } catch (Exception e) { splog.LogError(e.GetType().Name + " - " + e.Message); throw new Exception("See inner exception", e); } }
public IEnumerable <RSSitem> GetNews(string databaseName, string companyId) { // ToDo: Link to news feed if (databaseName == DataBases.NetsuiteInsphire) { return(new List <RSSitem>()); } IEnumerable <RSSitem> returnData; SPLog splog = new SPLog("GetNews", databaseName); try { returnData = _database().Query <RSSitem>( "web.GetNews", new { database = databaseName, companyid = companyId }, commandType: CommandType.StoredProcedure); splog.Log(); return(returnData); } catch (Exception e) { splog.LogError(e.GetType().Name + " - " + e.Message); throw new Exception("See inner exception", e); } }
public AdditionalInfo Delete(Guid libraryId, bool deleteLibrary) { var errorInfo = new AdditionalInfo(); try { var library = PublicApi.Libraries.Get(new LibraryGetOptions(libraryId)); PublicApi.Libraries.Delete(library, deleteLibrary); } catch (InvalidOperationException ex) { errorInfo.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointLibraryExtension.Translations.InvalidId, libraryId))); } catch (SPInternalException ex) { // The library has been already deleted errorInfo = new AdditionalInfo(new Error(ex.GetType().ToString(), plugin.Translate(SharePointLibraryExtension.Translations.NotFoundBecauseDeleted, libraryId))); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the WidgetApi.V2.SharePointLibrary.Delete() method for LibraryId: {1}. The exception message is: {2}", ex.GetType(), libraryId, ex.Message); SPLog.UnKnownError(ex, message); errorInfo.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointLibraryExtension.Translations.UnknownError))); } return(errorInfo); }
public PagedList <Document> List(Guid applicationId, [Documentation(Name = "FolderPath", Type = typeof(string), Description = "Folder server relative Url"), Documentation(Name = "PageIndex", Type = typeof(int)), Documentation(Name = "PageSize", Type = typeof(int)), Documentation(Name = "SortBy", Type = typeof(string)), Documentation(Name = "SortOrder", Type = typeof(string), Options = new[] { "Ascending", "Descending" })] IDictionary options) { var documents = new PagedList <Document>(); try { documents = PublicApi.Documents.List(applicationId, ProcessDocumentListOptions(options)); } catch (InvalidOperationException ex) { documents.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.InvalidLibraryId, applicationId))); } catch (SPInternalException ex) { documents.Errors.Add(new Error(ex.GetType().ToString(), plugin.Translate(SharePointFileExtension.Translations.LibraryNotFound, applicationId))); } catch (Exception ex) { string message = string.Format("An exception of type {0} occurred in the WidgetApi.V2.SharePointFile.List() method for LibraryId: {1}. The exception message is: {2}", ex.GetType(), applicationId, ex.Message); SPLog.UnKnownError(ex, message); documents.Errors.Add(new Error(ex.GetType().ToString(), ex.Message)); } return(documents); }