none
Live Connect for WPF Desktop Applications

    Question

  • Hello,

    I am trying to use the new Skydrive API in my WPF project. I found an unofficial API on codeplex, but I just don't want to use it because it is unofficial.

    So I downloaded the Live SDK. Browsing through the files of the Live SDK, I could only find binarys for Metro-Style and Windows Phone applications. I tried to use the binarys of the Windows Phone version - with no success.

    Is there any official API that I can use to access SkyDrive? I know I can just do raw-OAuth-Style, but I just can't find any samples.

    Everything I want to do ist to create a folder and upload files. I hope there is something that matches the comfort of the Windows Phone version of the API.

    Hope you'll excuse my language, I'm German.

    Sincerely,

    nikeee

    Sunday, January 08, 2012 4:25 PM

Answers

  • Thanks for reaching out to us! As you pointed out Live SDK currently supports Windows Phone and Metro Style applications. At this point of time my recommendation would be to evaluate these apis or do the raw-oauth style application. We currently don't have a WPF sample but you can take a look at the Silverlight sample https://github.com/liveservices/LiveSDK/tree/master/Samples/CSharpDesktop

    Thanks

    Deepesh

    Monday, January 09, 2012 1:46 AM

All replies

  • Thanks for reaching out to us! As you pointed out Live SDK currently supports Windows Phone and Metro Style applications. At this point of time my recommendation would be to evaluate these apis or do the raw-oauth style application. We currently don't have a WPF sample but you can take a look at the Silverlight sample https://github.com/liveservices/LiveSDK/tree/master/Samples/CSharpDesktop

    Thanks

    Deepesh

    Monday, January 09, 2012 1:46 AM
  • This sample is pretty useless. It show you how to sign in, and nothing else. There's no file list, upload, download, ect. Is there a WPF/Silverlight exmple that shows how to work with SkyDrive?

    • Proposed as answer by TCP cloud Tuesday, May 22, 2012 2:32 PM
    • Unproposed as answer by TCP cloud Tuesday, May 22, 2012 2:32 PM
    Friday, April 27, 2012 12:47 AM
  • This sample is pretty useless. It show you how to sign in, and nothing else. There's no file list, upload, download, ect. Is there a WPF/Silverlight exmple that shows how to work with SkyDrive?

    We are working on adding an updated Silverlight sample that shows how to work with SkyDrive. 
    Friday, April 27, 2012 8:47 AM
  • I had exactly the same problem and after many days of searching online decided to create my own class in C#. Here is just a few API examples. To download TcpLiveConnect API or see working example please go here: C# SkyDrive API via Live Connect REST API

    public string getUserInfoUrl(string szUserId) { return getReqUrl(szUserId); }

    public string getImageUrl(string szUserId) { return getReqUrl(szUserId + "/picture"); }

    public string getRootAlbumsUrl(string szUserId) { return getReqUrl(szUserId + "/albums"); }

    public string getMyContactsUrl() { return getReqUrl("me/contacts"); }

    public string getMyFriendsUrl() { return getReqUrl("me/friends"); }

    public string getFolderItemsUrl(string szFolderId, string szFilter) { string szReg = "/"+ szFolderId +"/files"; if (szFilter != null && szFilter.Length > 0) { szReg += "?filter=" + szFilter; } return getReqUrl(szReg); }

    public string getAlbumFilesUrl(string szAlbumId) { return getReqUrl(szAlbumId + "/files?filter=photos,videos,audio"); }

    public WLPhotoData getAlbumFiles(WLAlbumObj oAlbumInfo) { string szAlbumData = makeRequest(getAlbumFilesUrl(oAlbumInfo.id)); WLPhotoData oData = photoDataDeserializeJson(szAlbumData); return oData; }

    public void getAlbumFiles(WLAlbumObj oAlbumInfo, EventDelegate dwnldCompletedDelegate) { makeAsyncRequest(getAlbumFilesUrl(oAlbumInfo.id), dwnldCompletedDelegate); // response will be in e.Result & e.Error }

    public WLTagsCollData getItemTags(string szItemId) { string szTagData = makeRequest(getReqUrl(szItemId + "/tags")); WLTagsCollData oData = tagsCollDataDeserializeJson(szTagData); return oData; }

    public void getItemTags(string szItemId, EventDelegate dwnldCompletedDelegate) { makeAsyncRequest(getReqUrl(szItemId + "/tags"), dwnldCompletedDelegate); // response will be in e.Result & e.Error }

    public void makeAsyncRequest(string szReqUrl, EventDelegate dwnldCompletedDelegate) { WebClient wc = new WebClient(); wc.Proxy.Credentials = CredentialCache.DefaultCredentials; wc.Encoding = System.Text.Encoding.UTF8; wc.DownloadStringCompleted += new DownloadStringCompletedEventHandler(dwnldCompletedDelegate); // response will be in e.Result & e.Error wc.DownloadStringAsync(new Uri(szReqUrl)); }

    public string makeRequest(string szReqUrl) { WebClient wc = new WebClient(); wc.Proxy.Credentials = CredentialCache.DefaultCredentials; wc.Encoding = System.Text.Encoding.UTF8; string szResponse = wc.DownloadString(szReqUrl); return szResponse; }

    protected string getReqUrl(string szRequest) { string szUrl = ""; if (getSessInfo(m_szClientId).ContainsKey("access_token")) { szUrl = cLIVE_API_URL+ szRequest; if (szUrl.Contains("?")) szUrl += "&" + getSessInfo(m_szClientId)["access_token"]; else szUrl += "?" + getSessInfo(m_szClientId)["access_token"]; } return szUrl; }

    public static WLUserInfoObj userInfoDeserializeJson(string szJson) { var oJSSerializer = new JavaScriptSerializer(); WLUserInfoObj oData = oJSSerializer.Deserialize<WLUserInfoObj>(szJson); return oData; }

    public static WLAlbumsCollData albumsCollDataDeserializeJson(string szJson) { var oJSSerializer = new JavaScriptSerializer(); WLAlbumsCollData oData = oJSSerializer.Deserialize<WLAlbumsCollData>(szJson); return oData; }

    public static WLPhotoData photoDataDeserializeJson(string szJson) { var oJSSerializer = new JavaScriptSerializer(); WLPhotoData oData = oJSSerializer.Deserialize<WLPhotoData>(szJson); return oData; }

    public static WLTagsCollData tagsCollDataDeserializeJson(string szJson) { var oJSSerializer = new JavaScriptSerializer(); WLTagsCollData oData = oJSSerializer.Deserialize<WLTagsCollData>(szJson); return oData; }

    public static object genericDataObjDeserializeJson(string szJson) { var oJSSerializer = new JavaScriptSerializer(); object oData = oJSSerializer.DeserializeObject(szJson); return oData; }

    public static Dictionary<string, object> genericDataDicDeserializeJson(string szJson) { var oJSSerializer = new JavaScriptSerializer(); Dictionary<string, object> oData = oJSSerializer.Deserialize<Dictionary<string, object>>(szJson); return oData; }



    • Edited by TCP cloud Tuesday, May 22, 2012 8:43 PM
    Tuesday, May 22, 2012 8:36 PM
  • For 15 years I program in windows environment.
    Now I'm just thinking to change ... do you realize what you're doing ... first priority given to a hypothetical developer in java, ios, android, php .... you are forgetting all your old friends who buy Visual Studio for 15 years

    P.S. perhaps it is fashionable to GitHub ... but you can not put everything on TFS at least I do not have waxing every time a new account tomorrow ... fashion is XXX then?!?!
    Use your products ... the ones that make you eat


    • Edited by CogalSAGE Tuesday, October 01, 2013 3:31 PM lapsus
    Tuesday, October 01, 2013 3:12 PM