Answered by:
System Settings Through code

Question
-
Hi ,
Is there a way to retrieve system setting through code, I am trying to retrieve set blocked file extensions for attachments.
Please help,
Thanks in advance.
Friday, November 2, 2012 1:42 PM
Answers
-
Hi,
yes, you can use the Organization entity for this and especially the "blockedattachments" attribute. You can issue a "Retrieve" to get the organization using the organization service and then read this attribute (type string) to find the blocked extensions.
You can also have a look here for reference.
Greetings,
Pavlos
Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
View my latest gallery contribution here.
Visit my blog here.- Proposed as answer by Pavlos Panagiotidis Friday, November 2, 2012 2:43 PM
- Marked as answer by JLattimerMVP, Moderator Tuesday, November 27, 2012 4:55 AM
Friday, November 2, 2012 1:49 PM
All replies
-
Hi,
yes, you can use the Organization entity for this and especially the "blockedattachments" attribute. You can issue a "Retrieve" to get the organization using the organization service and then read this attribute (type string) to find the blocked extensions.
You can also have a look here for reference.
Greetings,
Pavlos
Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
View my latest gallery contribution here.
Visit my blog here.- Proposed as answer by Pavlos Panagiotidis Friday, November 2, 2012 2:43 PM
- Marked as answer by JLattimerMVP, Moderator Tuesday, November 27, 2012 4:55 AM
Friday, November 2, 2012 1:49 PM -
Here is also some sample code you could use in a plugin for example:
public void Execute(IServiceProvider serviceProvider) { var tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService)); var pluginContext = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); var serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory)); var service = serviceFactory.CreateOrganizationService(pluginContext.UserId); var organization = service.Retrieve("organization", pluginContext.OrganizationId, new ColumnSet(new[] { "blockedattachments" })); tracingService.Trace("{0}", organization.GetAttributeValue<string>("blockedattachments")); }
Greetings,
Pavlos
Please mark this reply as an answer and vote it as helpful if it helps you find a resolution to your problem.
View my latest gallery contribution here.
Visit my blog here.- Proposed as answer by Pavlos Panagiotidis Friday, November 2, 2012 2:43 PM
Friday, November 2, 2012 2:35 PM -
thx.Monday, November 5, 2012 12:29 PM
-