I am very new to Microsoft Dynamics CRM. I am trying to connect to my demo account through REST API using SOUP Ui. But every time I am getting authorization failed error( Error code 401). How should I pass my login credentials in HTTP Header. I am not using SDK, I am just making a rest API call. Please help me in this. If my question is too broad please let me know. I will update my question.
Regards
Not sure how Soup UI works but it sounds like you will need to provide login credentials.
The MSDN has a C# sharp example.
private HttpClient getNewHttpClient(string userName,string password,string domainName, string webAPIBaseAddress)
{
HttpClient client = new HttpClient(new HttpClientHandler() { Credentials = new NetworkCredential(userName, password, domainName) });
client.BaseAddress = new Uri(webAPIBaseAddress);
client.Timeout = new TimeSpan(0, 2, 0);
return client;
}
Can u tell me exactly what should I use for the argument domainName
This depends on exactly what type of CRM setup (online, on-premise, IFD) you are trying to connect to.
Have a look at this and this which demonstrates various connection string details. The samples are using a different connection mechanism to use the SOAP services, but I would expect the username, domain, to be the same with the REST endpoint.
Do u know which are all authentication types Microsoft Dynamics CRM
accepts like (Basic, NTLM, etc) ?
Authenticate users in Microsoft Dynamics CRM
Microsoft Dynamics CRM supports three security models for
authentication: claims-based authentication, Active Directory
authentication, and OAuth 2.0. The type of authentication used depends
on the type of deployment your application is accessing, Microsoft
Dynamics CRM Online or Microsoft Dynamics CRM 2016, and if your
application is using the Web API or the Organization Service.
Related
I'm working on an email trigger component where I have been able to successfully use client_credentials flow with Microsoft graph API.
However I want to be able to use spring email and bring in benefits it provides over a rest api call to the Microsoft graph API, things like using thymeleaf email templates for decorating the emails.
I tried doing that by first getting the token from Microsoft graph and use it as the password for the JavaMailSender instance and by using host as smtp.office365.com but it didn't work. I followed this link for that experiment JavaMail connecting to Office 365 XOAUTH2 for IMAP Authentication fails
Is there an easy way to do this? I want to basically get the best of both worlds, spring email and Microsoft graph API
I am following microsoft's dotnet core sample, and under the try this sample section it says:
Update ConnectionSettingName in GraphAuthenticationBot.cs so the bot can perform OAuth calls through Azure Bot Service
What should the value of ConnectionSettingName be?
in GraphAuthenticationBot.cs file, you need update below string to the name you have given while creating a connection in Azure Portal.
private const string ConnectionSettingName = "";
I have a bot service in which I created a new get endpoint using the following
code:
[HttpGet]
[Route("bot/test")]
public async Task TestController()
{
// Do some stuff
}
Now I want to hit the endpoint using the fiddler. But my request is not getting authenticated. I am using bot sdk v3. Earlier when I was using bot sdk v1, I was able to make request using fiddler by providing
authentication: basic base64(appId:appsecret)
Any pointers as to How can I make request to v3 bot service?
You may want to consider using the Bot Framework Emulator instead of Fiddler. It provides a much richer debugging experience.
I am creating an Azure AD App that is using the new Yammer delegated permissions preview to post a message to Yammer using the access token that I obtained from Azure AD. Unfortunately, I get a 401 Unauthorized response when trying to call Yammer Rest APIs.
Here is the code sample:
var resourceId = "https://www.yammer.com";
var endpointUrl = "https://www.yammer.com/api/v1/messages/following.json";
AuthenticationHelper helper = new AuthenticationHelper();
helper.EnsureAuthenticationContext(AuthenticationHelper.AuthorityMultitenant, resourceId);
var token = helper.AuthenticationResult.AccessToken;
HttpClient hc = new HttpClient();
hc.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
var result = await hc.GetAsync(new Uri(new Uri("https://www.yammer.com"), endpointUrl));
Here I get the 401 Unauthorized, with a message "Authentication failure". I tried also with api.yammer.com instead of www.yammer.com, with no change. I know that the tokens are being retrieved correctly, as I tested them with other Office 365 REST APIs.
My assumption is that the token is in an unaccepted format, but it is supposed to accept Azure Tokens now that the Delegated Permissions were added. Am I using the wrong resource ID and endpoint?
Your code sample looks correct. Does your user have an active Yammer subscription?
From an answer on the Yammer IT Pro Networks group for Office 365 developers, this:
Yammer authorization in apps is still handled completely separate from
the rest of Office 365. You need to create a Yammer app in your
network, and the users still needs to click the consent dialog to
authorize it.
Yes, there is a delegated permission for Yammer API in Azure AD, but
unless I am mistaken this does not actually do anything.
This is not from a Yammer source, because they never offer any kind of developer support or up-to-date documentation, but it seems entirely likely that this is another "feature" that simply doesn't work at all.
I have found the resolution for the problem. It appeared to be that Yammer authentication can be configured in 2 ways - one way is to configure it to use the same authentication as other parts of Office 365, and another one is to is using a different configuration.
If Yammer's own SSO is used (in other words, Yammer has a separaate configuration for ADFS), then this problem happens.If you disable Yammer SSO for your network, all yammer authentication for “mapped” users will be handled by Office365. When that’s done, you can then use the Office 365 API.
Does Outlook.com support EWS? If no, what are the different ways to access a users tasks and calendar using python?
So far I have done the following:
Used EWSWrapper and tried out using suds-ews with python. All these implementation fail when i try with an outlook.com account.
So here is what I want to know:
If EWS is not available , what other ways can I do to retrieve task and calendar list .
Is there a library in python that I can use which considers, earlier 2007 exchange servers, the newer once from 2010 to 2013 and does basic error handling.
Any help is appreciated.
Yes it supports now
Microsoft migrated from the legacy infrastructure to latest Office 365 based infrastructure
Following code snippet in c# will send HelloWorld message via EWS from outlook.com
var service = new ExchangeService
{
TraceEnabled = true,
TraceFlags = TraceFlags.All,
Credentials = new WebCredentials("user#outlook.com", "p#ssw0rd"),
Url = new Uri("https://outlook.com/EWS/Exchange.asmx")
};
var email = new EmailMessage(service);
email.ToRecipients.Add("recipient#outlook.com");
email.Subject = "HelloWorld";
email.Body = new MessageBody("This is the first email I've sent by using the EWS Managed API.");
email.Send();
For more code samples visit EWS Managed API docs
Currently the consumer facing Outlook.com (this is the Hotmail replacement, not to be confused with the Office 365 offering which uses the same root domain name) does NOT support EWS. It only supports EAS.
See this thread: http://answers.microsoft.com/en-us/windowslive/forum/mail-profile/i-want-to-access-outlookcom-account-over-exchange/83971a95-7fb3-483a-96fc-ac7e0299345b?msgId=71d12357-f735-4958-baef-39997b5802c8
I'm a C#-Developer so I don't know how it works in Python, but EWS Managed API works with ExchangeOnline. I'm already using it.
Maybe you have to enable redicreting in the autodiscover. See:
http://msdn.microsoft.com/en-us/office365trainingcourse_10l_1_topic2
I tried to connect to Outlook.com with ServerVersion 2010 and 2013-Setting and both work fine.
Outlook.com accounts do not support the EWS exchange service API especially when trying to use the oAuth2 token obtain from live.com.
It is recommended to try and use the REST API. The REST API is currently enabled on all Office 365 accounts that have Exchange Online and some Outlook.com accounts.
You can find more detailed information about it here and here