yesterday I created a new installation of Microsoft CRM Online.
Now I'm trying to access the webservice using the sdk provided from Microsoft.
When i try to connect to Microsoft CRM Online I get this error:
An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
I read in some posts that it can be the hours difference between my machine and the CRM Online Server, but I've tried running this code unsuccessfully using all the hours.
CrmConnection crmConnection = CrmConnection.Parse("Url=https://desenvolvimento.crm2.dynamics.com/XRMServices/2011/Organization.svc; Username=jones.rives#desenvolvimento.onmicrosoft.com; Password=XXX;");
OrganizationService service = new OrganizationService(crmConnection);
Entity account = new Entity("account");
account["name"] = "Test Account";
account.Id = Guid.NewGuid();
Guid accountId = service.Create(account);
Is it different to connect to CRM Online using 365 credentials? I really can't find the problem, and I've tried many solutions, but none worked.
Thanks in advise.
You don't need to put the endpoint inside the connection string when you use the simplified connection, just the organization url.
Assuming your url is correct (meaning you can login using a browser), try with:
CrmConnection crmConnection = CrmConnection.Parse("Url=https://desenvolvimento.crm2.dynamics.com; Username=jones.rives#desenvolvimento.onmicrosoft.com; Password=XXX;");
OrganizationService service = new OrganizationService(crmConnection);
Entity account = new Entity("account");
account["name"] = "Test Account";
Guid accountId = service.Create(account);
Related
I am following this link Book An Appointment In CRM Dynamics Using C# and am able to create the appointment in CRM Dynamics Calendar, which in turn returns the GUID and it's visible in Dynamics Calendar too.
Also, I was able to change the Appointment status from "open" to "Scheduled" by using entity SetStateRequest as follows but still I can't get this appointment synced/visible into my Outlook Calendar.
Any suggestions would be highly appreciated. Thanks
Guid _appointmentId = organizationService.Create(appointment);
var state = new SetStateRequest
{State = new OptionSetValue(3),
Status = new OptionSetValue(5),
EntityMoniker = new EntityReference("appointment", _appointmentId)};
var stateSet = (SetStateResponse)organizationService.Execute(state);
CRM & Exchange mailbox is still not connected using Server side sync. You have to configure your CRM mailbox record to sync the Appointment, Contact & Task (can be configured only in any one of the environment)
Read more
Go to your CRM system user record & open the associated Mailbox record, verify the Mailbox is configured properly for Incoming/Outgoing/ACT, O365 global admin approval, then “Test & Enable”.
Reference
I'm trying to use CrmServiceClient class from the last CRM SDK to retrieve data from a Dynamics 365 environment.
CrmServiceClient caches connection info, even when new instances of CrmServiceClient are created and disposed!. My application connects to different CRMs urls, so I use the flag "RequireNewInstance=true;" in the connection string to avoid caching.
When this flag is used, the performance is terrible (more than 30 seconds to retrieve any data).
Any clues how can I get acceptable performance when accessing different online CRMs?
Here is a simple sample code, but any service call takes a lot of time, not just this:
string connectionString="Url=https://myTest.api.crm.dynamics.com/; Username=myUser#myTest.onmicrosoft.com; Password=myPassword; AuthType=Office365;RequireNewInstance=true;";
using (var client = new Microsoft.Xrm.Tooling.Connector.CrmServiceClient(connectionString))
{
var orgService = (IOrganizationService)client.OrganizationWebProxyClient ?? client.OrganizationServiceProxy;
var response = (RetrieveVersionResponse)orgService.Execute(new RetrieveVersionRequest());
}
Note: I used to use the CrmConnection class from previous SDKs, this had much better response times but now this cannot be used to access CRM online (v 8.1.1 or above)
I've just started on CRM and ran into some trouble with calling the Organization service.
I've read that for online CRM that I need to get the device ID and password and pass that in the method. This is done by calling the HelperCode in the SDK "DeviceIdManager".
All I wanted to do was simply connect to the service and then I'd do what I needed to do (e.g. retrieve account information).
To keep it simple I did (not real username and password):
Uri orgUri = new Uri("https://xxx.api.crm.dynamics.com/XRMServices/2011/Organization.svc");
ClientCredentials cc = new ClientCredentials();
cc.UserName.UserName = "abc123#xxx.onmicrosoft.com";
cc.UserName.Password = "abc123";
//GetDeviceCredentials is from the SDK helper class
OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(orgUri, null, cc, GetDeviceCredentials());
orgProxy.Authenticate();
This is the error on the Authenticate():
I searched around and it seems that I've followed the general idea of what others have done.
Any suggestions on how I can get it to authenticate properly so i can query the account entity would be great.
I've done something similar using the Discover Service and that works (without the Device Credentials) so I'm a bit perplexed of what I've done wrong here.
Thanks for your time.
I feel like a brick.
I should have paid more attention to the MSDN.
The call should have been "LoadOrRegisterDevice" instead of GetDeviceCredentials.
I am trying to establish a connection with Exchange 2013 to retrieve a list of Contacts (from Global Contacts) given a certain criteria. This code works from a test console application, but when I place it in an Outlook Add-In, then it fails to even execute the method that contains the connection code, without throwing any exception. This is an extract of the code:
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013);
service.UseDefaultCredentials = true;
service.AutodiscoverUrl(emailAccount, RedirectionUrlValidationCallback);
NameResolutionCollection coll = service.ResolveName(searchStr, ResolveNameSearchLocation.DirectoryThenContacts, true);
Anybody has any idea why is this happening? Or if there is another way to search for Global Contacts in Exchange 2013 from an Add-In?
Currently I'm working on a task to fix the process of opening custom web page in outlook client from custom ribbon button, it's similar to this question:
JavaScript pop-up in Dynamics CRM 2011 Outlook client
client
However, I have configured the website to have the same authentication token from the same ADFS as CRM web. If I open it using IE/any other web browsers (in UR 12), it works fine. If I open it using outlook client, it keep prompting the user to authenticate (which is quite annoying for some users).
I've read these, but they are only applicable for CRM form, not custom web app:
ADFS (CRM 2011) - Authentication Issue in Microsoft Outlook Client for CRM (Response.Redirect(...) & Window.Open(...))
http://msdn.microsoft.com/en-us/library/jj602956.aspx
Anyone have any idea on this?
FYI, I'm using CRM 2011 UR 12, and Outlook 2010 with CRM client.
TIA
I ended-up using openStdWin, based on: http://blog.customereffective.com/blog/2011/12/jscript-pop-up-in-crm-402011-internet-explorer-vs-outlook.html and Dieter's comment. It still asked me to authenticate once, even though I've provided the login detail in outlook client setup.
The javascript function:
function openNewWindow(url) {
var name = "newWindow";
var width = 800;
var height = 600;
var newWindowFeatures = "status=1";
var oldWindowFeatures = "width=800,height=600,status=1";
// Regular Jscript function to open a new window
//window.open(url, name, oldWindowFeatures);
// CRM function to open a new window
openStdWin(url, name, width, height, newWindowFeatures);
// CRM function to open a new window
// with default CRM parameters
//openStdWin(url, name);
}