xamarin ios/android apps, and OAUTH for office 365 common consent framework


we were able to get the office 365 connected service (for xamarin projects) wizard to build out a framework project – the helloworld app for IOS.

image

 

WP_20140618_11_51_39_Pro__highres[1]

 

The oauth parameters are read from the assembly (wehre the wizard writes them). To make it work, one must launch the library from a UIViewController that is active – i.e. from a button callback on said controller object.

async public void getusers()
{
    IEnumerable<IMessage> x; ;
    try
    {
        x = await MailApiSample.GetMessages(this);
        var s = x.Count();
    }
    catch (Exception ex)
    {
        ;
    }
}

public override void ViewDidLoad()
{
    base.ViewDidLoad();
    View.Frame = UIScreen.MainScreen.Bounds;
    View.BackgroundColor = UIColor.White;
    View.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;
    button = UIButton.FromType(UIButtonType.RoundedRect);
    button.Frame = new RectangleF(View.Frame.Width / 2 – buttonWidth / 2,
        View.Frame.Height / 2 – buttonHeight / 2,
        buttonWidth,
        buttonHeight);

    button.SetTitle(“Click me”, UIControlState.Normal);
    button.TouchUpInside += (object sender, EventArgs e) =>
    {
        this.getusers();
        button.SetTitle(String.Format(“clicked {0} times”, numClicks++), UIControlState.Normal);
    };

    button.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleTopMargin |
        UIViewAutoresizing.FlexibleBottomMargin;

    View.AddSubview(button);
}

Advertisements

About home_pw@msn.com

Computer Programmer who often does network administration with focus on security servers. Very strong in Microsoft Azure cloud!
This entry was posted in AAD. Bookmark the permalink.