/// <summary> /// Generates a web request to return a listing of all files and subdirectories in the directory. /// </summary> /// <param name="uri">The absolute URI to the share.</param> /// <param name="timeout">The server timeout interval.</param> /// <param name="listingContext">A set of parameters for the listing operation.</param> /// <param name="shareSnapshot">A <see cref="DateTimeOffset"/> specifying the share snapshot timestamp, if the share is a snapshot.</param> /// <param name="useVersionHeader">A flag indicating whether to set the x-ms-version HTTP header.</param> /// <param name="operationContext">An <see cref="OperationContext" /> object for tracking the current operation.</param> /// <returns>A web request to use to perform the operation.</returns> internal static HttpWebRequest List(Uri uri, int?timeout, FileListingContext listingContext, DateTimeOffset?shareSnapshot, bool useVersionHeader, OperationContext operationContext) { UriQueryBuilder directoryBuilder = GetDirectoryUriQueryBuilder(); DirectoryHttpWebRequestFactory.AddShareSnapshot(directoryBuilder, shareSnapshot); directoryBuilder.Add(Constants.QueryConstants.Component, "list"); if (listingContext != null) { if (listingContext.Marker != null) { directoryBuilder.Add("marker", listingContext.Marker); } if (listingContext.MaxResults.HasValue) { directoryBuilder.Add("maxresults", listingContext.MaxResults.ToString()); } if (listingContext.Prefix != null) { directoryBuilder.Add("prefix", listingContext.Prefix); } } HttpWebRequest request = HttpWebRequestFactory.CreateWebRequest(WebRequestMethods.Http.Get, uri, timeout, directoryBuilder, useVersionHeader, operationContext); return(request); }
/// <summary> /// Generates a web request to return the user-defined metadata for this directory. /// </summary> /// <param name="uri">The absolute URI to the directory.</param> /// <param name="timeout">The server timeout interval.</param> /// <param name="shareSnapshot">A <see cref="DateTimeOffset"/> specifying the share snapshot timestamp, if the share is a snapshot.</param> /// <param name="accessCondition">The access condition to apply to the request.</param> /// <param name="useVersionHeader">A flag indicating whether to set the x-ms-version HTTP header.</param> /// <param name="operationContext">An <see cref="OperationContext" /> object for tracking the current operation.</param> /// <returns>A web request to use to perform the operation.</returns> internal static HttpWebRequest GetMetadata(Uri uri, int?timeout, DateTimeOffset?shareSnapshot, AccessCondition accessCondition, bool useVersionHeader, OperationContext operationContext) { UriQueryBuilder directoryBuilder = GetDirectoryUriQueryBuilder(); DirectoryHttpWebRequestFactory.AddShareSnapshot(directoryBuilder, shareSnapshot); HttpWebRequest request = HttpWebRequestFactory.GetMetadata(uri, timeout, directoryBuilder, useVersionHeader, operationContext); request.ApplyAccessCondition(accessCondition); return(request); }