开发者

Microsoft MyPhone - .NET access possible?

I've searched this as much as I can in the time available, but haven't turned anything up. Does anyone know if it is possible to access data backed up from a WinMo device to Microsoft's MyPhone开发者_如何学运维 service programatically, without having to restore all the data back to the device? I'm looking at a way of also keeping a local backup of contacts and SMS messages on my desktop machine, but it seems that if there is an API for doing so, Microsoft haven't advertised it at all.

I'm hoping that my inability to find any reference on Google is due to my incompetence rather than it not being supported by Microsoft.


I know this is very late, but I just run into the same problem, and I found a workaround. For this to work you need to login into MyPhone from IE, so that the authentication cookie can be used by the code. Also check the "Remember Me" checkbox when you login. Then it is just a meter of using HTTPRequest with that cookie. From here on, you need to parse the response HTML and extract the information you need "by hand".

I am working on this, because my Win 6.5 phone was stolen, I switched to Android because I cannot consider Win 7 phones as a finished product, and I need to recover my contact information.

I don't have much time to invest in this little project, but I hope it will be done in a couple of days. This small program will eventualy be able to save a csv file containing all the contact information from the MyPhone web app.

I will share the code, so anyone that wants to use it or make further changes is free to do so.

So far, this is a snippet to give you a start:

string siteUrl = "http://sn1-p1.myphone.microsoft.com/mkweb/storage/Contacts.po";

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(siteUrl);

        request.CookieContainer = new CookieContainer();
        List<Cookie> cookies = new List<Cookie>();
        StreamReader sr = File.OpenText(@"c:\Users\user\AppData\Roaming\Microsoft\Windows\Cookies\user@myphone.microsoft[2].txt");

        while(!sr.EndOfStream)
        {
            string name = sr.ReadLine();
            string value = sr.ReadLine();
            string domain = sr.ReadLine();
            string capacity = sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            sr.ReadLine();
            if(!sr.EndOfStream)
            {
                sr.ReadLine();
            }
            var cookie = new Cookie(name, value, "/", "myphone.microsoft.com");
            cookies.Add(cookie);
        }

        foreach (var cookie in cookies)
        {
            request.CookieContainer.Add(cookie);
        }

        HttpWebResponse response = (HttpWebResponse)request.GetResponse();

        using (StreamReader reader = new StreamReader(response.GetResponseStream()))
        {
            string tmp = reader.ReadToEnd();
        }


After a bit more digging I found a reference on the MyPhone user forum to say that there is no public API for this kind of operation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜