/// <summary> /// Lists all of the blobs in a container. /// </summary> /// <returns>The containers.</returns> /// <param name="">.</param> public IEnumerator ListBlobs(Action <IRestResponse <BlobResults> > callback, string resourcePath = "") { Dictionary <string, string> queryParams = new Dictionary <string, string>(); queryParams.Add("comp", "list"); queryParams.Add("restype", ResType.container.ToString()); StorageRequest request = Auth.CreateAuthorizedStorageRequest(client, Method.GET, resourcePath, queryParams); yield return(request.Send()); request.ParseXML <BlobResults>(callback); }
public IEnumerator PutBlob(Action <RestResponse> callback, byte[] bytes, string resourcePath, string filename, string contentType, Method method = Method.PUT) { int contentLength = bytes.Length; // TODO: check size is ok? Dictionary <string, string> headers = new Dictionary <string, string>(); string file = Path.GetFileName(filename); headers.Add("Content-Type", contentType); headers.Add("x-ms-blob-content-disposition", string.Format("attachment; filename=\"{0}\"", file)); headers.Add("x-ms-blob-type", "BlockBlob"); string filePath = resourcePath.Length > 0 ? resourcePath + "/" + file : file; StorageRequest request = Auth.CreateAuthorizedStorageRequest(client, method, filePath, null, headers, contentLength); request.AddBody(bytes, contentType); yield return(request.Send()); request.Result(callback); }