private void SetData() { JObject content = (JObject)Message.Content; string internalFileReference = (string)content[InternalFileReferenceKey]; if (internalFileReference != null) { requestPath = FileReference.Parse(internalFileReference).Path; return; } JToken data = content[DataKey]; if (data == null || data.Type == JTokenType.Null) { return; } if (uploadAsFile) { string sourcePath = (string)data; if (sourcePath.StartsWith("file://")) { sourcePath = (new Uri(sourcePath)).AbsolutePath; } requestPath = contentManager.CreateUniqueFilename(Path.GetExtension(sourcePath)); using (IsolatedStorageFile userStore = IsolatedStorageFile.GetUserStoreForApplication()) { userStore.CopyFile(sourcePath, requestPath); } Message.Content[InternalFileReferenceKey] = (new FileReference(requestPath, null)).ToString(); MessageStore.Outbox.Update(Message); } else { string contentType = GetHeader("content-type"); if (contentType != null && contentType == "application/json") { requestData = Encoding.UTF8.GetBytes((string)data.ToString()); } else if (contentType != null && contentType.StartsWith("text/")) { requestData = Encoding.UTF8.GetBytes((string)data); } else { requestData = Convert.FromBase64String((string)data); } } }