Read CRM 2013 system settings from Plugin code - plugins

I wonder if there is any possibility to read (not write!) the system settings from a plugin in Microsoft Dynamics CRM 2013. It can be easily done for the user settings but I couldn't find any way to do the same thing with system settings too. I would need to read the "blocked file extensions for attachments" setting.

You can load settings via the entity "organization", the following code will read the value of the Discount Calculation Method property:
var query = new QueryExpression("organization");
query.ColumnSet.AddColumn("discountcalculationmethod");
var org = this.orgservice.RetrieveMultiple(query).Entities.First();
Assert.IsNotNull(org["discountcalculationmethod"]);

Related

How to let office online own the style of view mode?

Recently, I would like to use the “edit mode” of Office Online Server to open the Microsoft Word file as follows:
http://office-online/we/wordeditorframe.aspx?WOPISrc=...&access_token=...
However, I notice that there is no gap between two consecutive pages, please see the following screenshot.
In addition, when I use the “view mode” to view a word document with wordviewframe.aspx, the presentation of page is normal.
http://officeonline/wv/wordviewerframe.aspx?WOPISrc=...&access_token=...
But this time I discover that the Edit in Browser button(in the top right-hand corner)cannot be used.
I have added the attributes such as
HostEditUrl, EditModePostMessage in CheckFileInfo described in official document.
So I have two questions:
1) How to let “edit mode” own the style of “view model”? Namely, there is some space between two word page.
2) How to switch to edit-mode from view mode?
Thanks very much.
Your WOPI host (your own API which implemented WOPI Protocol) must,
Implement methods PutFile (to save updated file on your storage) and PutRelativeFile (to create a new file based on the current file, for example converting from .doc to be .docx).
Return following data in the response of CheckFileInfo operation.
2.1 SupportUpdate : true (to let WOPI Client know that your API implement the PutFile and PutRelativeFile methods)
2.2 UserCanWrite : true (to indicate that the use have Write permission over the file)
2.3 LicenseCheckForEditIsEnabled : true (to route user to Microsoft Login page to verify that the user have Office 365 license)
2.4 HostEditUrl : url_to_your_edit_page
NOTE: Your user need MS Office 365 license in order to edit file on WOPI.
.
1) This might actually be a bug in the OOS. Can you verify that the problem persists when you switch the <ui=UI_LLCC&><rs=DC_LLCC&> to English locale & open a document written in English? Just to rule out this possibility.
2) The HostViewUrl and HostEditUrl is supposed to lead to a "host page" - an HTML page which will host an iframe that points to an Office for the web application. => Not to the OOS URL directly.

CRM 2016-Plugin Registring New Step

I am very new to MSCRM, so requesting for help. I am using Office365, i.e. MSCRM online organisation.
Here, I have written a plugin which should be fired when, in an Account entity, user uploads his image, the plugin stores the image as an attachment, in notes.
The plugin works fine, when I tested it by writing a console application.
I have registered the plugin and believe it will work fine here too. The only problem is I am unable to register the plugin new step.
The problem is in Filtering Attributes , I am unable to get entityimage attribute, even if i select/check All attributes.
Please suggest how should I proceed.
In this scenario you can write plugin on "Create" message of "Annotation" entity. And create message does not have any filtered attributes.
As you wrote and tested using Console Application, while converting it to plugin make sure that you are checking created note contains data into "FileName" and "DocumentBody" attribute. Along with you can also check whether this note is created against "Account" entity. This two conditions will narrow your scope, limited to notes created against account having some attachment. In plugin execution context you'll get above mentioned attributes.

Get identity of logged in Visual Studio user from extension

I'm developing a visual studio 2015 extension and I'm looking to get the identity of the user who's logged into the IDE (different to the user logged in to windows, or running devenv).
I can't figure out where (or if) I can get that information. It doesn't appear to be in the DTE object anywhere and googling around hasn't helped.
Just the username
string username = System.Environment.UserName;
or
string adName = System.Environment.UserDomainName;
Full UserPrinciple
System.DirectoryServices.AccountManagement.UserPrincipal.Current
Most the normal .net methods for getting users from system or globals should work. All the AD namespaces (System.DirectoryServices) will also work as usual.
Also this regkey gets set at vs startup with the interactive user.
Code:
C#
General:
in header / above namespace
MVC: Not sure about earlier version but 3 - 5 not required
using System.Security.Principal
function, property etc
string userid= User.Identity.Name.toString()

How can I change the time that an e-mail was received via Microsoft Exchange Server or Microsoft Outlook?

As the question says, how can I change the time that an e-mail was received either via Microsoft Outlook or via Microsoft Exchange Server (as an Administrator account) directly?
There are numerous GUI tools online that plug in to Microsoft Outlook and allow you to change various things (including the received date/time) of an e-mail, and these changes are then pushed back to the server.
My question though concerns how to do such without these shareware GUI tools that are available online i.e. directly through Microsoft Outlook or Microsoft Exchange Server (as an Administrator account) using PowerShell or the like.
Outlook Object Model exposes the MailItem.ReceivedTime and MailItem.SentOn properties. Unfortunately they are read-only, even though your can change these properties using Extended MAPI (C++ or Delphi only) - the properties are PR_MESSAGE_DELIVERY_TIME and PR_CLIENT_SUBMIT_TIME respectively. Worse than that, OOM has an annoying habit of updating the ReceivedTime property every time MailItem.Save is called.
Note that creation and last modification dates cannot be changed using any API - these values are automatically updated by the store provider.
You can manually modify PR_MESSAGE_DELIVERY_TIME and PR_CLIENT_SUBMIT_TIME properties using OutlookSpy (I am its author) - select the message, click the IMessage button, double click on these properties to edit them.
If using Redemption (any language, I am its author) is an option, it allows to modify these properties. The following VB script will update the dates of the currently selected message in Outlook:
TheDate = #2015/12/01 2:00 pm#
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Item = Session.GetMessageFromID(Application.ActiveExplorer.Selection(1).EntryID)
Item.ReceivedTime = TheDate
Item.SentOn = TheDate
Item.Save

Where does Context.Track<T> information go?

I have tried
public sealed class WriteMessage : CodeActivity
{
protected override void Execute(CodeActivityContext context)
{
context.Track(new BuildInformationRecord<Foo>()
{
Value = FooInstance,
});
}
}
and
then found an overload on context.Track that accepts <T>
context.Track(FooInstance);
and neither one appears in the build viewer in visual studio.
context.TrackBuildMessage(string data) certainly does.
and I'm not getting any exception, is it being saved to the tfs data store, or a file? or is just silently failing entirely?
Reference to one of the resources implicating how this works or should work from the code side
it actually does make it its way to the datastore. Your instance is converted into a Dictionnary<String,String> by reflection on its properties (you may provide a type converter to Dictionnary<String,String> if you like) then stored as a build record into the database. Records are logically structured as a tree. You may retrieve this info through the TFS API.
You are using a new type for TFS which is "Foo". Thus, your info cannot yet be displayed on the build reports in Visual Studio because VS doesn't know how to represent it. You actually need to extend VS build reports with a custom addin that can convert this into WPF controls for rendering.
If you track a "BuildMessage", this is a well known type by VS, it will be displayed in the build log.
You may as well develop a Warehouse adapter to bring this data from the stored build reports to the TFS warehouse store (and also the TFS cube).
About adding custom info into the build :
http://blogs.msdn.com/b/patcarna/archive/2009/11/19/tfs-2010-customizing-build-information-part-2.aspx (and have a look at part 1)
My article on my blog in french (answers exactly your question, sorry, yeah... french) :
http://blogs.codes-sources.com/vlabz/archive/2011/09/24/tfs-2010-enrichir-les-donn-es-d-un-build.aspx
Hope this helps.
(I can't post more links at the moment since I'm a new user, contact me directly I'll send you nice URLs, or google for "Changing The Way Build Information IS Displayed")