Office365 Unified Api - Share file with specific user and get file thumbnail - c#

I am trying to do the following two things:- Share file with specific user- Get thumbnail for a file
I am currently using the Office 365 Unified Api and I'd like to keep it that way if possible.
I thought it would be possible to get the thumbnails for a file like this:
"https://<tenant>.sharepoint.com/_api/v1.0/me/files/" + id + "/thumbnails"
This returns the following error
{
"code": "-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
"message": "The expression drive/items/<id>/thumbnails is not valid."
}
As for the file sharing, I have no idea where to start. I hope someone can help me out with this, thanks in advance.

The thumbnails feature is available in the v2 of the Files API - please refer to https://dev.onedrive.com/items/thumbnails.htm. The feature to share file with a specific user will be available in this API by the end of the month.
You can find the complete documentation at http://dev.onedrive.com. This API is currently in preview, and general availability is planned to happen before the end of the year. Please note that all new features and fixes are being added to the v2 API.

Related

[BotFramework][Cortana] How does a user send Attachments to the Bot within Cortana?

I created a Chatbot (Microsoft Botframework) with a Cortana Skill where i am trying to prompt the user to upload an attachment.
The prompt is asking the user to upload the file as specified (Code below) but i do not see a possibility of uploading files in Cortana. Is there a way to make this work? Thanks a lot!
var dialog = new PromptDialog.PromptAttachment("Please upload the sick
note you received from your doctor.", "Sorry, I didn't get the document.
Try again please.", 2);
context.Call(dialog,this.uploadAttachmentResumeAfter);
The Cortana Skills Kit does not presently support file uploads through Cortana. However, you can work around this by deep linking - add the capability to support a html form file upload in your app and follow the steps to invoke it in the mentioned doc.
Hope this helps.

Get a file from OneDrive and use data of xml file into C# application

I have place a xml file online on OneDrive and shared whit everyone that use my program. Now I want to read this into my C# application. I have try a lot of code. A list below:
I have try whit a HttpClient and a HttpResponseMessage. But it give me the html code from the webpage of OneDrive. I understand why if you look to the page.
I have also looking for to use LiveSDK in my application whit the following code:
try
{
LiveConnectClient liveClient = new LiveConnectClient(this.session);
LiveOperationResult operationResult = await liveClient.GetAsync(#"https://onedrive.live.com/?****");
dynamic result = operationResult.Result;
}
catch (LiveConnectException ex)
{
Debug.WriteLine("LiveConnectException catched => " + ex.Message);
}
But I can't create an instance of LiveConnectClient because you need to log in and I don't want that. Found on this links: "Working with Microsoft OneDrive folders and files" on MSDN and "Store LiveConnectSession in WP7" on Stackoverflow.
Can anyone help me or explain it? I need only the xml code (not the html code) and will make a graph of the data. I use the language C# for load the file. Sorry for my bad english or some mistakes, I'm new with Microsoft Live accounts and access in into an application.
Thanks
If you have a single file that you'd just like your clients to be able to download, you'll just want to assemble a variant on the sharing link that you received from the share UI, which should look like this:
https://onedrive.live.com/redir
?resid=8bf6ae9dbc6caa4c!116505
&authkey=!AD0q0bcg_i3dmvg
&ithint=file%2ctxt
You will want to modify the path from redir into download, and you can removed the ithint parameter so the request looks like the following:
https://onedrive.live.com/download.aspx
?resid=8bf6ae9dbc6caa4c%216505
&authkey=%21AD0q0bcg_i3dmvg
This url should allow you to make an anonymous request and download that shared file for your applications usage.
For more robust sharing scenarios, I'd recommend looking at https://dev.onedrive.com for a list of all supported scenarios with examples on how to use them

Get all of the videos and activities from a Youtube user

I'm trying to get all of the videos uploaded by a Youtube user, the Uri I used is this one : https://gdata.youtube.com/feeds/api/users/userId/uploads, which I've got from this link.
The same goes with the user activities it seems I can't get all of the user activities using the Uri described in the same website.
So anyone has any idea how to get all of the user's uploads and activities?
There are 7 (in words: seven) samples of how to get the uploaded videos with the new awesome v3 Api here:
https://developers.google.com/youtube/v3/code_samples/
It should be easy to look at one and convert it into the language of your desire.
With this tool you can test all the variations of input to find out how to get all videos:
https://developers.google.com/youtube/v3/docs/playlistItems/list#try-it
(Spoiler: Default settings)
You can get the PlaylistID that contains all uploads by fetching the channel Informations:
https://developers.google.com/youtube/v3/docs/channels/list#try-it
I recommend that you take a look at the V3 API and good luck!

cloudfront private time limited url

I have a client that wants to sell tutorial videos online. I already got previews of his tutorials streaming from CF (This is public). Now I want to use the c# sdk to generate private, time limited URLs to allow customers who purchased the tutorials to download them for a limited time period.
Once the payment has been confirmed, I want to generate a URL and send it to the client via email.
Does CF/.NET SDK support this?
Can someone point me at a sample. I have searched Google, and got a little information overload. Different examples from different versions of sdk/management console. Please help me make sense of it all :)
If you look at the class Amazon.CloudFront.AmazonCloudFrontUrlSigner that has helper methods for creating presigned URL to private distributions. For example this code snippet creates a url that is valid for one day.
var url = AmazonCloudFrontUrlSigner.GetCannedSignedURL(AmazonCloudFrontUrlSigner.Protocol.http, domainName, cloudFrontPrivateKey, file, cloudFrontKeyPairID, DateTime.Now.AddDays(1));
There are other utility methods in that class for adding more specific access rules.
Note this class was added in version 1.5.2.0 of the SDK which came out in late Augest
Yes Amazon S3 as well as CloudFront both support preSignedUrl access. If you want to faster content delivery the you should use CloudFront. Mr. Norm Johanson saying correct. To generate signed url you will need of Public-Private key pair. You can user your own key pair and lets associate with you account of Amazon S3 or you can also generate it at amazon s3 account and download to generate presigned url
You can use the GUI or code in S3SignURL to sign your URL
https://github.com/DigitalBodyGuard/S3SignURL
You can't do this with CloudFront (CF), but you can do this directly with S3. You simply call the GetPreSignedURL function to generate a time-limited URL to a specific (private) S3 item. This approach is covered in a tutorial here.
The simplest code sample is this:
AmazonS3 client;
GetPreSignedUrlRequest request = new GetPreSignedUrlRequest();
request.WithBucketName(bucketName);
request.WithKey(objectKey);
request.Verb = HttpVerb.GET; // Default.
request.WithExpires(DateTime.Now.AddMinutes(5));
string url = client.GetPreSignedURL(request);

What are the available functions to send notifications to a Facebook user?

Currently I am using Codeplex's Facebook Developer Toolkit version 2 for my ASP.net Facebook application. I would like to be able to send notifications to a user's Inbox or wall of the application and was wondering what are the available functions to do that? If not in the API, then please provide example functions from the main Facebook library. This will help immensely. Thanks!
After a brief search I found an example of sending notifications using the toolkit:
facebook.Components.FacebookService fs
= new facebook.Components.FacebookService();
fs.ApplicationKey =
ConfigurationManager.AppSettings["APIKey"];
fs.Secret =
ConfigurationManager.AppSettings["Secret"];
string sessionKey =
dict["facebook_session_key"];
fs.SessionKey = sessionKey; fs.uid =
long.Parse(member.FacebookId);
fs.notifications.send(member.FacebookId,
"notification message");
(from: http://facebooktoolkit.codeplex.com/Thread/View.aspx?ThreadId=49876)
After looking through the Codeplex source it's clear that this sends a user-to-user notification, and therefore requires an active user session of the sender.
Codeplex does not appear to support app-to-user notifications which do not require a session, but adding this feature would be trivial. Add a type variable to the send method and set it accordingly based on the API documentation here: http://wiki.developers.facebook.com/index.php/Notifications.send
The source code for the notifications.send method in the Codeplex Developer Toolkit is here:
http://facebooktoolkit.codeplex.com/SourceControl/changeset/view/28656#233852
Please keep in mind that the Codeplex developer toolkit source code has not been updated in over 3 months. This means that it does not support many new Facebook API features and changes. You may want to browse the client library wiki page to find a library that is more up to date: http://wiki.developers.facebook.com/index.php/Client_Libraries

Categories