Folder.Bind Method in Graph SDK client using C# - microsoft-graph-sdks

We need folder.bind similar method in Graph SDK using C#.
Below method works with Outlook Exchange services but for O365 user its not working.
var msgRootFId = new EWS.FolderId(EWS.WellKnownFolderName.MsgFolderRoot, new EWS.Mailbox(SMTPAddress));
msgRoot = EWS.Folder.Bind(service, msgRootFId, EWS.BasePropertySet.IdOnly);

You can call one of the following endpoints. Instead of id you can use well-known folder name msgfolderroot
GET /me/mailFolders/{id}
GET /me/mailFolders/msgfolderroot
GET /users/{id | userPrincipalName}/mailFolders/{id}
GET /users/{id | userPrincipalName}/mailFolders/msgfolderroot
Resources:
mailFolder resource type
get mailFolder

Related

How to authenticate with Blockfrost.io API?

So I'm trying to import Cardano Blockchain data like address balance, amount staked, rewards etc into a Google Sheet. I found this project named Blockfrost.io which is an API for accessing Cardano blockchain info and import it into apps etc.
I think I can use this with Google Sheets. Problem is I don't know how to authenticate. I've searched all around on the documentation and it's not clear to me. It seems it's possible if your're building an app or using the terminal.
But I just want to authenticate in the easiest way possible like in the browser address bar that way it would be simple to get the JSON with the info I need and import the info to Google Sheets.
This is where it mentions the Authentication:
https://docs.blockfrost.io/#section/Authentication
I already have an API key to access. But how do I authenticate?
So if I want to check the blockchain metrics (mainnet1234567890 is a dummy key, I won't use mine here):
https://cardano-mainnet.blockfrost.io/api/v0/metrics/project_id:mainnet1234567890
The JSON will still output this:
status_code 403
error "Forbidden"
message "Missing project token. Please include project_id in your request."
Is there a correct way to authenticate on the browser address bar?
It's not clear which BlockFrost API you are using Go JavaScript etc...
the API key goes in as a header on the request object. I was manually trying to connect to the service and found for a request is what I had to do in C#...
var aWR = System.Net.WebRequest.Create(url);
aWR.Method = "GET";
aWR.Headers.Add("project_id", "mainnetTheRestOfMyKeyIsHidden");
var webResponse = aWR.GetResponse();
var webStream = webResponse.GetResponseStream();
var reader = new StreamReader(webStream);
var data = reader.ReadToEnd();
Later I realized I wanted to use their API cause they implement the rate limiter, something I would rather use than build... I use the following with the BlockFrost API in c#
const string apiKey = "mainnetPutYourKeyHere";
const string network = "mainnet";
// your key is set during the construction of the provider.
ServiceProvider provider = new ServiceCollection().AddBlockfrost(network, apiKey).BuildServiceProvider();
// from there individual services are created
var AddressService = provider.GetRequiredService<IAddressesService>();
// The call to get the data looked like
AddressTransactionsContentResponseCollection TXR = await AddressService.GetTransactionsAsync(sAddress, sHeightFrom, sHeightTo, 100, iAddressPage, ESortOrder.Desc, new System.Threading.CancellationToken());
// etc. your gonna need to set the bounds above in terms of block height
Try using postman and include the "project_id" header with api key as the value like this - it will clear up the concept for you I think:enter image description here

Create EmailMessage out of Aspose.Net Email MapiMessage?

Is there a way to create an EWS EmailMessage class instance out of Aspose.Net Email MapiMessage class instance?
I'm trying to use some common logic for email processing.
1) I have a service processing emails coming to an Exchange folder, and everything works just perfectly.
2) Also, I have users able to upload email files (*.msg) into the web app. These emails are processed using Aspose.Net.Email and I have an instance of MapiMessage as an output.
What I can try to do is to use MapiMessage .ToMailMessage() method, which will create an instance of MailMessage from this MapiMessage. But even after that, I wasn't able to find a way to create an EmailMessage to be able to use the processing logic from 1).
Any suggestions?
I have observed your requirements and if I am correctly understanding you are looking for support for interface between Aspose.Email MapiMesaage class and EWS EmailMesage class. These two classes belong to two different APIs and have no interface between them. Aspose.Email for .NET does allow saving as MSG or EML file format and you may load them on your end using EmailMessage class.
I am working as Support developer/ Evangelist at Aspose.
https://learn.microsoft.com/en-us/dotnet/api/microsoft.exchange.webservices.data.emailmessage?view=exchange-ews-api
https://apireference.aspose.com/net/email/aspose.email.mapi/mapimessage/constructors/1

set-userphoto using ews managed api 2.2

is it possible to set the user photo using the ews api 2.2? -- not a contact photo!
same as powershell command Set-UserPhoto
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
service.Url = new Uri("https://mail.xxx.xxx/ews/Exchange.asmx");
thanks
No this isn't possible because there is no underlying EWS operation to allow you to Set the user photo . There is a full list of the EWS operations on http://msdn.microsoft.com/en-us/library/office/bb409286(v=exchg.150).aspx.
One thing you can do with EWS that would be unsupported is modify the User photo object that gets created in the Root of the Mailbox. eg if you look at the Mailbox with a Mapi editor like MFCMapi and look at Items in the NonIPM Root of the Mailbox you'll see the UserPhoto object (it has a MessageClass of IPM.UserPhoto) if a userphoto has been set. In the object there are extended properties that have the Photo stored in all the different Image formats that are supported. But I don't think this method would give you a proper solution.
Cheers
Glen

Telerik Reporting - Passing object to UriReportSource Html5 reporting

I'm wondering how to passing the object data source into html5 report viewer.
I have view like this:
#{
var theData = new UriReportSource();
theData.Uri = "TestingReport.trdx";
//this is should passing the data right?
theData.Parameters.Add("passing", Model.pasing);
theData.Parameters.Add("anotherPassing", Model.another);
}
#(
Html.TelerikReporting().ReportViewer()
.TemplateUrl("../ReportViewer/templates/telerikReportViewerTemplate.html").Id("ReportId")
.ReportSource(theData)
.ViewMode(ViewModes.PRINT_PREVIEW)
.ScaleMode(ScaleModes.SPECIFIC)
.Scale(1.0)
.ServiceUrl("/api/reports/")
)
I already wired up the .trdx report into object data source.
And this documentation is not helping, it's use TypeDataSource.
.ServiceUrl() is what your looking for.
Url.Content("/api/reports/") is what Telerik has in their examples as the argument to ServiceUrl. It assumes the api is implemented in the same application as the client (viewer).
To go across domains the server has to apply CORS to the API
e.g.
.ServiceUrl(Url.Content("(prefix + server):9176/api/reports/"))` (a different web api application on localhost) is the call to make on the client.

How to get collaboration ID using box api

I am trying to get the collaboration for a given folder. In the Box sdk given on github the function is public Collaboration GetCollaboration(string collaborationId, IEnumerable fields = null). My question is how do i get the collaboration ID??? After reading the comments in [link] Is there any way to get all files and folder in box without knowing their id? I thought the ID of a given folder is to be given but when i provide that I get an exception "404 not found". Although my folder id "867049500" does have a collaboration enabled. Please see the image below
The official Windows SDK provides a method that will fetch the collaborations for a known folder:
var client = new BoxClient(...);
var collabs = await client.FoldersManager.GetCollaborationsAsync(folderId);
(Edited 8/29/14 to point to official SDK)
Rather than this i have been able to explore an alternative for this:
var boxManager = new BoxApi.V2.BoxManager(userToken);
From the above code you get the boxManager, and further:
var testFolder = boxManager.GetFolder(FolderID);
From the above code you get the Folder, and further pass it as shown below:
CollaborationCollection sampleCollabs = boxManager.GetCollaborations(testFolder, false, null);
It has worked out for me, so i am sharing the solution.
Using Python, the following can get the collaboration attributes.
Step 1 : Use get_collaborations() method which returns a collaborations collection
collaborations = client.folder(folder_id='Your_target_folder_id').get_collaborations()
Step 2 : Then iterate over collaborations to get the specific collaboration ID
for collab in collaborations:
collaboration_id = collab.id