Reset a Password from a Outlook Live Mailbox

Standard

In order to use this code you have to grab the Class Sessions from this link and read the introduction

Using Microsoft.LiveAtEdu.Samples.Powershell.OutlookLive.Users.MailBox;

// <summary>
/// Resets the password.
/// </summary>
/// <param name="caixaCorreio">Caixa correio.</param>
/// <param name="novaPassword">Nova password.</param>

public static string ResetPassword(string mailBox, string novaPassword)
{
    try
    {
        OutlookLiveMailBox mb = new OutlookLiveMailBox(Sessions.ConnectMe());
        mb.ResetPwd(mailBox, novaPassword);
        return "1";
    }
    catch (Exception ex)
    {
        return ex.Message;
    }
    finally
    {
        Sessions.DisconnectMe();
    }
}

Create a Mailbox in Outlook Live

Standard

In order to use this code you have to grab the Class Sessions from this link and read the introduction

CODE

I am returning a String to grab the Exception, if created return “1”. This work’s but for instance if a mailbox with the same name is already created it will not give any exception, at least for me.

Using  Microsoft.LiveAtEdu.Samples.Powershell.OutlookLive.Users.MailBox;

/// <summary>
/// Cria Caixa de Correio.
/// </summary>
/// <param name="primeiroNome">Nova Caixa Correio Primeiro Nome</param>
/// <param name="ultimoNome">Nova Caixa Correio ultimo nome.</param>
/// <param name="nomeParaDisplay">Nome display</param>
/// <param name="caixaCorreio">O Email a criar</param>
/// <param name="password"></param>
public static string CreateMailBox(string firstName, 
                                   string lastName, 
                                   string displayName, 
                                   string mailBox, 
                                   string password)
{
    try
    {
        OutlookLiveMailBox mb = new OutlookLiveMailBox(Sessions.ConnectMe());
        mb.CreateMailBox(firstName, lastName, displayName, mailBox, password);
        return "1";
    }
    catch (Exception ex)
    {
        return ex.Message;
    }
    finally
    {
        Sessions.DisconnectMe();
    }
}