Dynamics 365 CRM SDK or Rest API - c#

I need to create a CRM E-Mail activity with attachement from code. As far as I know there are two ways to do this. I could use the dynamics 365 CRM SDK or the dynamics 365 CRM Rest API. My question is which one I should use at the moment? I know Microsoft has many good API, but many of them seemed unfinished to me. Can you guys help me out?

I've you're in the .Net Framework, always use the SDK. It hasn't really changed since 2011, and they are slowly porting the calls over from the SOAP endpoint to the WebApi for you, with no work on your end.

If you are doing integration from outside CRM, I would recommend WEB API which is the cross-platform RESTful solution going forward. Before 8.x CRM version - SDK was the only option available (still you can use it today).
The keywords are important, you can find lot of community blogs for code samples & better documentation. You can setup Postman & test the web api endpoints, even you can use CRM REST Builder for development purpose.
Endpoint: <your instance url>/api/data/v9.1/emails
Create Email with attachment using SDK
Create Email using web api
Adding attachments using web api

Related

How to start with the Google API for Gmail?

I want to receive mails from Gmail in my .NET project with Visual Studio 2022.
I've installed all required NuGet Packages, and now I'm searching for a detailed description of this API.
Which classes and methods are available?
I found something at developers.google.com.
But I miss an overview of the classes and methods.
Or what does the API do?
Right now, I'm able to forward the user of my app to allow me the access to Gmail. I receive the "code", but I have to transform it into a "token2".
Do I have to send a HTTP by myself? Why can I not find a .Net function to do that for me?
Sorry for asking, but I'm searching since two hours for the answer...
Gmail API + Google .net client library Nuget Gmail package.
I've installed all required NuGet Packages, and now I'm searching for a detailed description of this API.
A detailed description of the Gmail api and all its methods can be found on Gmail API documentation page. The documentation for the API lists all the methods that can be used and their required parameters and the responses.
As for the NuGet package for Google.Apis.Gmail.v1 there is no documentation for each of the methods related to each of the Google APIs. This library is generated from the discovery doc so there will be a method in the library for each of the methods listed in the Gmail API documentation. It is "assumed" that by consulting the Gmail API documentations you can "Determine" what method in the library you would need to use.
There is an extremally out of date documentation page for API Client Libraries
.NET
which only goes into some detail of the overall usage of the library it self. It does not tell you how to use every method in every api that it supports.
If you can not figure it out by looking at the documentation as mentioned above then, Your best bet would be to check the assembly directly in visual studio this is something that I am able to do in Rider I would be surprised if Visual studio can not do something similar.
If you have a specific question regarding one of the methods and how to use it in the library please open a new question I would be happy to help.
API vs Client library
what does the API do?
The API gives you access to Gmail api. The Gmail NuGet package gives you access to the Gmail api.
Right now, I'm able to forward the user of my app to allow me the access to Gmail. I receive the "code", but I have to transform it into a "token2".
Depending upon which type of application the library should be handling all the authorization for you. You shouldn't need to worry about the authorization code. Let the library do it for you. Please consult Authorization overview
Do I have to send a HTTP by myself? Why can I not find a .Net function to do that for me?
The library will do all this for you.
var results = service.Users.Labels.List("me").Execute
Will return that response to you.
Links
I think you should start with a few simple examples in order to understand how the Google .NET client library helps you interact with the Gmail api.
Gmail quickstart
How to Access Gmail with C# .net

How to go about it: sync/export data for Accounts from Microsoft Dynamics 365 CRM and show it in a 3rd party web app? Using WS and ASP.NET MVC/C#

I'm trying to get data from Microsoft Dynamics 365 CRM, specifically the Accounts and their data to show it in my own web app that I will build using ASP.NET MVC and C#.
How would I go about doing this so that my web app will instantly be updated when the data in CRM changes? I find it difficult enough navigating through the Dynamics platform already, thanks Microsoft.
The app would work like this:
When run, the app would get the initial data, and establish a real-time connection with WS to the CRM to get further new data/changes.
the app will display this data in a table.
When a change is detected, the web app should update without refreshing the page.
individual table rows will be colored according to number of contacts and if they lack any contact data.
I've started researching webhooks with MS CRM, but it seems Visual Basic is crapping out on me a lot and I cant get the tools to work properly . I think that I have to establish a connection somehow with WebSocket to the CRM, I just don't know which technologies to use and what plugins there are, seeing I'm new to ASP.NET MVC and C#.
Anyway, I just don't know where to start. Could someone send me in the right direction? I would greatly appreciate it!
You can access the data inside a Dynamics 365 / Power Apps instance (also known as Dynamics CRM or Dynamics 365 CE) using the APIs provided by the system.
You can leverage these APIs using the SDK provided by Microsoft (this one https://www.nuget.org/packages/Microsoft.CrmSdk.XrmTooling.CoreAssembly/ or this one in preview for .NET Core https://www.nuget.org/packages/Microsoft.PowerPlatform.Dataverse.Client/) or by calling the API directly inside the language of your choice.
Usually you need to deal with CRUD events, and the APIs can do that. In your question you mention "the web app should update without refreshing the page" so you will need to take a look at webhooks (here a doc page https://learn.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/use-webhooks) handle them in your application and see if they fit your requirements.

How do I determine if a PayPal account is verified using the new .NET REST Libraries

So I installed PayPal.net SDK 1.7.0 in Visual Studio 2010 using the Nuget package. With all my readings this is the 'latest and greatest' and promises to be the most forward compatible library there is from PayPal.
I am having no problem testing the Payout functionality, works nicely.
However, before I do a Payout, I would like to determine if the PayPal user is Verified (address, or bank account), before allowing the Payout. The only documentation I can find that describes what I need here is only available in a soon-to-be-deprecated library called 'Adaptive Accounts'.
https://github.com/paypal/adaptiveaccounts-sdk-dotnet
You go right to the GitHub link, and it even recommends NOT to use it. So, how exactly do I achieve this functionality of pre-verification before issuing a Payout?
This Classic SDK is not actively supported and will be deprecated in
the future. For full support on new integrations, please use the
PayPal .NET SDK
So do I use it or is this functionality supported in the new libraries I have installed, but just can`t find documentation on?
Our REST API library doesn't have any support for AdaptiveAccounts as of this moment.
If you would like to use Adaptive Accounts API, you will need to use Classic API integration. The specific API you should be using is called GetVerifiedStatus API.
https://developer.paypal.com/webapps/developer/docs/classic/api/adaptive-accounts/GetVerifiedStatus_API_Operation/
If you are looking for a SDK for it, here is the newest SDK available for AdaptiveAccounts: https://www.nuget.org/packages/PayPalAdaptiveAccountsSDK/
This will not be depreciated, at least not anytime soon until REST API supported AdaptiveAccounts API.

How to retrieve all Office 365 users in the same domain with C#?

Microsoft provides a PowerShell command Get-Msoluser to retrieve all office 365 users. I don't want my application tied to PowerShell, so I want to write a C# function to do the work, unfortunately, there's not much information on this topic.
I looked in the Office 365 APIs Preview documentation, no such functionality; also I looked into the SharePoint Client Object Model, no such thing either.
Can this be done without PowerShell? Is there a SDK can do this?
Yes, you can use the Azure AD Graph Client Library. There are also a couple of samples in that link that will show you how to retrieve your user(s).
This library is available as a nuget package.
https://www.nuget.org/packages/Microsoft.Azure.ActiveDirectory.GraphClient/1.0.2

Auth service using Web Api, membership provider, and SQL Server 2012

I am looking to write an auth service using Web Api, and SQL Server for authenticating and authorizing users on my .net site, but ios and Android apps as well. I'm speculating that basic authentication over SSL is the easiest way to go, but I'm pretty new to this whole section of .net. I'm having trouble finding some clear tutorials that explain how to write such a service. Can anyone point me to some resources on how to do this? I'd appreciate it.
I think you need to look OAuth implementation in .NET.
Here is a video to give you some background on Web API security.
I also suggest getting a trial subscription to Pluralsight training and check out the courses on Web API security.
You may want to target the latest release of Web API 2.0 from Microsoft, it has the most features you'll need.
I think this might be useful for you:
http://www.asp.net/web-api/overview/security/authentication-and-authorization-in-aspnet-web-api

Categories