public async Task <string> CreateMeeting() { // create onlineMeetings var meetingUri = this.ucwaApp.ApplicationResource.GetEmbeddedResourceUri("onlineMeetings"); var myOnlineMeetingsUri = this.ucwaApp.ApplicationResource.GetEmbeddedResource("onlineMeetings").GetEmbeddedResourceUri("myOnlineMeetings"); var meetingInput = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<input xmlns=\"http://schemas.microsoft.com/rtc/2012/03/ucwa\">" + //" <property name=\"accessLevel\">Locked</property>" + " <propertyList name=\"attendees\">" + " <item>sip:[email protected]</item>" + " <item>sip:[email protected]</item>" + " </propertyList>" + " <property name=\"automaticLeaderAssignment\">Disabled</property>" + " <property name=\"description\">We'll be meeting to review the sales numbers for this past quarter and discuss projections for the next two quarters.</property>" + //" <property name=\"entryExitAnnouncement\">Unsupported</property>"+ //" <property name=\"expirationTime\">2014-03-09T16:34:29.9597697-07:00</property>"+ //" <propertyList name=\"leaders\">"+ //" <item>sip:[email protected]</item>"+ //" </propertyList>"+ //" <property name=\"lobbyBypassForPhoneUsers\">Disabled</property>"+ //" <property name=\"phoneUserAdmission\">Disabled</property>"+ " <property name=\"subject\">Test myOnlineMeetings</property>" + "</input>"; var opResult = await this.ucwaApp.Transport.PostResourceAsync(myOnlineMeetingsUri, meetingInput); string joinUrl = null; if (opResult.StatusCode == HttpStatusCode.OK) { this._resMyOnlineMeetings = opResult.Resource; joinUrl = _resMyOnlineMeetings.GetPropertyValue("joinUrl"); // used by attendees to join the meeting with a PUT request } return(joinUrl); }
public async Task <UcwaAppOperationResult> GetResourceAsync(string uri) { HttpResponseMessage response; string responseContent; try { response = await Client.GetAsync(uri); responseContent = await response.Content.ReadAsStringAsync(); try { var resource = new UcwaResource(responseContent); return(new UcwaAppOperationResult(response.StatusCode, response.Headers, resource)); } catch (Exception ex) { return(new UcwaAppOperationResult(response.StatusCode, response.Headers, responseContent, ex)); } } catch (TaskCanceledException tcex) { return(new UcwaAppOperationResult(HttpStatusCode.RequestTimeout, tcex)); } catch (Exception ex) { return(new UcwaAppOperationResult(HttpStatusCode.BadRequest, ex)); } }
private void HandleEvent(UcwaResource resource) { if (OnEventNotificationsReceived != null) { OnEventNotificationsReceived(new UcwaEventsData(resource.OuterXml)); } }
private async Task <HttpStatusCode> SetResource(string data, string name, UcwaResource parent) { if (string.IsNullOrEmpty(name) || parent == null) { return(HttpStatusCode.BadRequest); } return(await SetResource(data, parent.GetEmbeddedResourceUri(name))); }
private async Task <UcwaResource> GetResource(string resourceName, UcwaResource parent) { if (string.IsNullOrEmpty(resourceName)) { return(null); } if (parent == null) { return(null); } var uri = parent.GetEmbeddedResourceUri(resourceName); return(await GetResource(uri)); }
/// <summary> /// Get an application resource bound to the user's local endpoint /// </summary> /// <param name="resUser">The authenticated user resource</param> /// <param name="userAgent">The name of this application</param> /// <param name="culture">The locale of this application</param> /// <returns>The application resoure as part of UcwaAppOperationResult</returns> async Task <UcwaAppOperationResult> GetApplicationResource(UcwaResource resUser, string userAgent = "ContosoApp/1.0 (WinStore)", string culture = "en-us") { applicationsUrl = resUser.GetLinkUri("applications"); var endpointId = Guid.NewGuid().ToString(); string appSettings = string.Format(appSettingsFormatter, culture, endpointId, userAgent); var result = await Transport.PostResourceAsync(applicationsUrl, appSettings); if (result.StatusCode != HttpStatusCode.Created) { return(new UcwaAppOperationResult(result.StatusCode, result.ResponseHeaders, result.ResponseBody, new Exception("Failed to PostRequest on " + applicationsUrl))); } return(result); }
public async Task <IEnumerable <UcwaAppPhoneLine> > GetPhoneLines(string uri = null) { this.Phones = await GetPhones(uri); List <UcwaAppPhoneLine> phoneList = new List <UcwaAppPhoneLine>(); foreach (var xElem in this.Phones.EmbeddedResourceElements) { var resPhone = new UcwaResource(xElem); var phoneType = resPhone.GetPropertyValue("type"); var phoneNumber = resPhone.GetPropertyValue("number"); var inConactCard = resPhone.GetPropertyValue("includeInContactCard"); phoneList.Add(new UcwaAppPhoneLine(phoneNumber, phoneType, inConactCard)); } return(phoneList.AsEnumerable()); }
private string GetNextEventUri(UcwaResource resource) { try { if (resource.LinkNames.Contains("resync")) { return(resource.GetLinkUri("resync")); } if (resource.LinkNames.Contains("resume")) { return(resource.GetLinkUri("resume")); } if (resource.LinkNames.Contains("next")) { return(resource.GetLinkUri("next")); } return(null); } catch { return(null); } }
public async Task <UcwaAppOperationResult> PostResourceAsync(string uri, HttpContent content) { var response = await Client.PostAsync(uri, content); var responseContent = await response.Content.ReadAsStringAsync(); if (string.IsNullOrEmpty(responseContent)) { return(new UcwaAppOperationResult(response.StatusCode, response.Headers)); } try { var resource = new UcwaResource(responseContent); return(new UcwaAppOperationResult(response.StatusCode, response.Headers, resource)); } catch (Exception ex) { return(new UcwaAppOperationResult(response.StatusCode, response.Headers, responseContent, ex)); } }
/// <summary> /// Contained resource is either an embedded or linked resource. /// </summary> /// <param name="name">The resource name</param> /// <param name="transport">A transport to get the linked resource.</param> /// <returns></returns> public async Task <UcwaResource> GetContainedResource(string name, UcwaAppTransport transport) { UcwaResource res = null; if (this.EmbeddedResourceNames.Contains(name)) { res = this.GetEmbeddedResource(name); } else if (this.LinkNames.Contains(name) && transport != null) { var linkUri = this.GetLinkUri(name); var result = await transport.GetResourceAsync(linkUri); if (result.StatusCode != System.Net.HttpStatusCode.OK) { return(null); } res = result.Resource; } return(res); }
public async Task <UcwaResource> Refresh(string uri = null) { if (string.IsNullOrEmpty(uri)) { this.Resource = await GetResource(this.Resource.Uri); } else { this.Resource = await GetResource(uri); } this.Note = await this.GetNote(); this.Presence = await this.GetPresence(); this.Location = await this.GetLocation(); this.Phones = await this.GetPhones(); var result = await this.GetPhotoStream(); this.Photo = result.ResponseBodyStream; // returns a MemoryStream object return(this.Resource); }
public UcwaResourceMessage(UcwaResource eventResource) : base(eventResource.OuterXml) { }
public UcwaResourceParticipant(UcwaResource eventResource) : base(eventResource.OuterXml) { }
//public UcwaResourceConversation(UcwaEvent e) : base (e.Resource.OuterXml) {} public UcwaResourceConversation(UcwaResource r) : base(r.OuterXml) { }
public UcwaResourceMessageInvitation(UcwaResource r) : base(r.OuterXml) { }
public UcwaAppOperationResult(HttpStatusCode status, HttpResponseHeaders httpHeaders, UcwaResource res) { this.Resource = res; this.ResponseHeaders = httpHeaders; this.StatusCode = status; }
public UcwaResourceCommunication(UcwaResource resource) : base(resource.OuterXml) { }
public async Task <string> GetLocationCoordinates(string uri = null) { this.Location = await GetLocation(uri); return(Location.GetPropertyValue("location")); }
public UcwaEventResource(UcwaResource res) { this.resource = res; }