Ejemplo n.º 1
1
        public CalendarAPI(ref GraphServiceClient client, ref ClassLogger appLogger, ref ClassLogger sdkLogger)
        {
            InitializeComponent();
            graphClient = client;
            applogger = appLogger;
            sdklogger = sdkLogger;

            dItemBody = new Dictionary<string, List<ItemBody>>();
            dAttendees = new Dictionary<string, List<Attendee>>();
            dCategories = new Dictionary<string, List<string>>();
            dRecurrencePattern = new Dictionary<string, RecurrencePattern>();
            dRecurrenceRange = new Dictionary<string, RecurrenceRange>();
            dFileAttachments = new Dictionary<string, List<FileAttachment>>();
            dItemAttachments = new Dictionary<string, List<ItemAttachment>>();
            dReferenceAttachments = new Dictionary<string, List<ReferenceAttachment>>();
            dCalendarIds = new Dictionary<string, string>();

            #pragma warning disable 4014
            GetFoldersAsync();
            #pragma warning restore 4014
        }
Ejemplo n.º 2
1
        public MailAPI(ref GraphServiceClient olClient, ref ClassLogger appLogger, ref ClassLogger sdkLogger)
        {
            InitializeComponent();
            graphClient = olClient;
            applogger = appLogger;
            sdklogger = sdkLogger;

            // init the dictionaries
            dRecips = new Dictionary<string, List<Recipient>>();
            dItemBody = new Dictionary<string, List<ItemBody>>();
            dBcc = new Dictionary<string, List<Recipient>>();
            dCc = new Dictionary<string, List<Recipient>>();
            dReplyTo = new Dictionary<string, List<Recipient>>();
            dCategories = new Dictionary<string, List<string>>();
            dFileAttachments = new Dictionary<string, List<FileAttachment>>();
            dItemAttachments = new Dictionary<string, List<ItemAttachment>>();
            dReferenceAttachments = new Dictionary<string, List<ReferenceAttachment>>();
            dFolderIds = new Dictionary<string, string>();

            #pragma warning disable 4014 
            GetFoldersAsync();
            #pragma warning restore 4014
        }
Ejemplo n.º 3
0
        public frmMain()
        {
            InitializeComponent();

            // init config helper
            config = new ConfigHelper();
            config.clientId = Properties.Settings.Default.ClientId;
            config.graphEndpoint = Properties.Settings.Default.GraphEndpoint;
            config.redirectUri = Properties.Settings.Default.RedirectUri;

            // init config values
            redirectUri = new Uri(config.redirectUri);
            authority = String.Format(CultureInfo.InvariantCulture, config.aadInstance, "common");
            clientId = config.clientId;
            graphApiEndpoint = config.graphEndpoint;
            
            // create log and token cache objects
            applogger = new ClassLogger("restfuloutlook-app.log");
            sdklogger = new ClassLogger("restfuloutlook-graphsdk.log");
            user = new LoggedOnUserHelper();
            fc = new FileCache(Environment.CurrentDirectory);

            // init button state
            btnMailAPI.Enabled = false;
            btnGraphAPI.Enabled = false;
            btnContactsAPI.Enabled = false;
            btnCalendarAPI.Enabled = false;
            btnReportingService.Enabled = false;
            btnUserPhotoAPI.Enabled = false;
        }
Ejemplo n.º 4
0
        public NewEventForm(ref GraphServiceClient olClient, ref ClassLogger appLogger, ref ClassLogger sdkLogger)
        {
            InitializeComponent();
            graphClient = olClient;
            applogger = appLogger;
            sdklogger = sdkLogger;

            // add 1/2 hour to the dtpend time
            dtpEndTime.Value = dtpEndTime.Value.AddMinutes(30);
        }
Ejemplo n.º 5
0
 public NewContactForm(ref GraphServiceClient olClient, ref ClassLogger appLogger, ref ClassLogger sdkLogger)
 {
     InitializeComponent();
     graphClient = olClient;
     applogger = appLogger;
     sdklogger = sdkLogger;
     emailAddresses = new List<EmailAddress>();
     businessPhones = new List<string>();
     homePhones = new List<string>();
 }
Ejemplo n.º 6
0
 public NewMessageForm(ref GraphServiceClient olClient, ref ClassLogger appLogger, ref ClassLogger sdkLogger)
 {
     InitializeComponent();
     graphClient = olClient;
     applogger = appLogger;
     sdklogger = sdkLogger;
     toRecipients = new List<Recipient>();
     ccRecipients = new List<Recipient>();
     bccRecipients = new List<Recipient>();
 }
Ejemplo n.º 7
0
        public ContactsAPI(ref GraphServiceClient client, ref ClassLogger appLogger, ref ClassLogger sdkLogger)
        {
            InitializeComponent();
            graphClient = client;
            applogger = appLogger;
            sdklogger = sdkLogger;

            dBusinessPhones = new Dictionary<string, List<string>>();
            dHomePhones = new Dictionary<string, List<string>>();
            dCategories = new Dictionary<string, List<string>>();
            dChildren = new Dictionary<string, List<string>>();
            dImAddresses = new Dictionary<string, List<string>>();
            dEmailAddresses = new Dictionary<string, List<string>>();
            dHomeAddress = new Dictionary<string, PhysicalAddress>();
            dOtherAddress = new Dictionary<string, PhysicalAddress>();
            dBusinessAddress = new Dictionary<string, PhysicalAddress>();

            #pragma warning disable 4014
            GetFoldersAsync();
            #pragma warning restore 4014
        }
Ejemplo n.º 8
0
        public GraphAPI(AuthenticationResult authResult, string anchor)
        {
            InitializeComponent();

            xAnchorMbx = anchor;

            // add hyperlinks to UI
            lnkQueryParams.Links.Add(0, 16, "http://graph.microsoft.io/en-us/docs/overview/query_parameters");
            lnkPaging.Links.Add(0, 6, "http://graph.microsoft.io/en-us/docs/overview/paging");
            lnkCallAPI.Links.Add(0, 21, "http://graph.microsoft.io/en-us/docs/overview/call_api");
            lnkErrors.Links.Add(0, 6, "http://graph.microsoft.io/en-us/docs/overview/errors");

            // create logger
            logger = new ClassLogger("restfuloutlook-graphexplorer.log");

            // init local auth result
            result = authResult;

            // populate the sample queries into the local dictionary
            PopulateComboBox();
        }
Ejemplo n.º 9
0
        public AttachmentsForm(string id, List<FileAttachment> fAttachments, List<ItemAttachment> iAttachments, List<ReferenceAttachment> rAttachments, ref ClassLogger appLogger)
        {
            InitializeComponent();
            applogger = appLogger;

            // init dictionaries
            dAdditionalFileData = new Dictionary<string, object>();
            dAdditionalItemData = new Dictionary<string, object>();
            dAdditionalRefData = new Dictionary<string, object>();
            dContentBytes = new Dictionary<string, byte[]>();

            try
            {
                Cursor = Cursors.WaitCursor;

                if (fAttachments != null)
                {
                    foreach (var fItem in fAttachments)
                    {
                        // populate the grid view for file attachments
                        int n = dgFileAttachments.Rows.Add();
                        if (fItem.ContentBytes != null)
                        {
                            dgFileAttachments.Rows[n].Cells[0].Value = "View Data";
                            dContentBytes.Add(fItem.Id, fItem.ContentBytes);
                        }
                        dgFileAttachments.Rows[n].Cells[1].Value = fItem.ContentId;
                        dgFileAttachments.Rows[n].Cells[2].Value = fItem.ContentLocation;
                        dgFileAttachments.Rows[n].Cells[3].Value = fItem.ContentType;
                        dgFileAttachments.Rows[n].Cells[4].Value = fItem.LastModifiedDateTime;
                        dgFileAttachments.Rows[n].Cells[5].Value = fItem.Id;
                        dgFileAttachments.Rows[n].Cells[6].Value = fItem.IsInline.ToString();
                        dgFileAttachments.Rows[n].Cells[7].Value = fItem.Name;
                        dgFileAttachments.Rows[n].Cells[8].Value = AttachmentHelper.SizeSuffix(fItem.Size.Value);

                        if (fItem.AdditionalData != null)
                        {
                            dgFileAttachments.Rows[n].Cells[9].Value = "View Data";
                            foreach (var data in fItem.AdditionalData)
                            {
                                dAdditionalFileData.Add(data.Key, data.Value);
                            }
                        }
                    }
                }

                if (iAttachments != null)
                {
                    // populate the grid for item attachments
                    foreach (var iItem in iAttachments)
                    {
                        int m = dgItemAttachments.Rows.Add();
                        dgItemAttachments.Rows[m].Cells[0].Value = iItem.ContentType;
                        dgItemAttachments.Rows[m].Cells[1].Value = iItem.LastModifiedDateTime;
                        dgItemAttachments.Rows[m].Cells[2].Value = iItem.Id;
                        dgItemAttachments.Rows[m].Cells[3].Value = iItem.Item;
                        dgItemAttachments.Rows[m].Cells[4].Value = iItem.IsInline.ToString();
                        dgItemAttachments.Rows[m].Cells[5].Value = iItem.Name;
                        dgItemAttachments.Rows[m].Cells[6].Value = AttachmentHelper.SizeSuffix(iItem.Size.Value);

                        if (iItem.AdditionalData != null)
                        {
                            dgItemAttachments.Rows[m].Cells[7].Value = "View Data";
                            foreach (var data in iItem.AdditionalData)
                            {
                                dAdditionalItemData.Add(data.Key, data.Value);
                            }
                        }
                    }
                }

                if (rAttachments != null)
                {
                    // populate the grid for reference attachments
                    foreach (var iItem in rAttachments)
                    {
                        int m = dgRefAttachments.Rows.Add();
                        dgRefAttachments.Rows[m].Cells[0].Value = iItem.ContentType;
                        dgRefAttachments.Rows[m].Cells[1].Value = iItem.LastModifiedDateTime;
                        dgRefAttachments.Rows[m].Cells[2].Value = iItem.Id;
                        dgRefAttachments.Rows[m].Cells[3].Value = iItem.IsInline.ToString();
                        dgRefAttachments.Rows[m].Cells[4].Value = iItem.Name;
                        dgRefAttachments.Rows[m].Cells[5].Value = AttachmentHelper.SizeSuffix(iItem.Size.Value);

                        if (iItem.AdditionalData != null)
                        {
                            dgRefAttachments.Rows[m].Cells[6].Value = "View Data";
                            foreach (var data in iItem.AdditionalData)
                            {
                                dAdditionalRefData.Add(data.Key, data.Value);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                applogger.Log("ctor exception:");
                applogger.Log(ex.Message);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }