/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="type"></param> /// <param name="bits"></param> /// <returns></returns> public async Task<MediaObjectInfo> NewMediaObject(string name, string type, byte[] bits) { var service = new Service(BlogConnectionInfo.MetaWeblogUrl); var inputStruct = new Struct(); inputStruct["name"] = new StringValue(name); inputStruct["type"] = new StringValue(type); inputStruct["bits"] = new Base64Data(bits); var method = new MethodCall("metaWeblog.newMediaObject"); method.Parameters.Add(BlogConnectionInfo.BlogId); method.Parameters.Add(BlogConnectionInfo.Username); method.Parameters.Add(BlogConnectionInfo.Password); method.Parameters.Add(inputStruct); var response = await service.Execute(method); var param = response.Parameters[0]; var _struct = (Struct)param; var mediaobject = new MediaObjectInfo { Url = _struct.Get("url", StringValue.NullString).String }; return mediaobject; }