Code Monkey home page Code Monkey logo

o365rwsclient's Introduction

o365rwsclient's People

Contributors

anirudhsanthiar avatar julienjtpierre avatar panjkov avatar selvasingh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

o365rwsclient's Issues

Deadlock reachable from RetrieveData

The code below deadlocks o365rwsclient when invoked from a GUI app (such as a Windows Forms app) or an MVC appllication.

            ReportingContext context = new ReportingContext();
            context.UserName = @"YOUR O365 EMAIL ADDRESS";
            context.Password = @"YOUR O365 PASSWORD";
            context.FromDateTime = DateTime.MinValue;
            context.ToDateTime = DateTime.MinValue;
            context.SetLogger(new DefaultLogger());

            IReportVisitor visitor = new DefaultReportVisitor();

            ReportingStream stream = new ReportingStream(context, "MailboxActivityDaily", "stream1");
            stream.RetrieveData();

The reason is that RetrieveData eventually calls GetResponseXml. The method
public List<XmlNode> GetResponseXml(Type reportType, QueryFilter filter) has the line
Stream responseContent = GetResponseContentAsync(serviceFullUrl).Result;

Blocking on the results of asynchronous methods is dangerous: see, for example,
http://blog.stephencleary.com/2012/07/dont-block-on-async-code.html

A possible fix is to configure the awaits in GetResponseContentAsync to not capture context using ConfigureAwait(false).

Add support for async/await

Ideally all methods making I/O calls should be marked with the async keyword and return a Task. This is important for the client classes as well as the contracts like ITraceLogger and IReportVisitor which will likely require making an async call in their implementation.

Add method for validating ReportingContext

The o365 Modular Input for Splunk invokes O365 using this library. It requires a user to provide credentials as well as a report name. Validation doesn't appear to happen until you attempt to Stream. It would be nice to have a simple validation method that can verify whether or not the credentials / report is valid without having to stream.

Perhaps there is a way to do this and it is just not obvious (to me).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.