/// <summary>
/// Replace an existing photo on Flickr.
/// </summary>
/// <param name="stream">The <see cref="Stream"/> object containing the photo to be uploaded.</param>
/// <param name="fileName">The filename of the file to replace the existing item with.</param>
/// <param name="photoId">The ID of the photo to replace.</param>
/// <returns>The id of the photograph after successful uploading.</returns>
public string ReplacePicture(Stream stream, string fileName, string photoId)
{
var replaceUri = new Uri(ReplaceUrl);
var parameters = new Dictionary <string, string>
{
{ "photo_id", photoId }
};
if (!string.IsNullOrEmpty(OAuthAccessToken))
{
OAuthGetBasicParameters(parameters);
parameters.Add("oauth_token", OAuthAccessToken);
var sig = OAuthCalculateSignature("POST", replaceUri.AbsoluteUri, parameters, OAuthAccessTokenSecret);
parameters.Add("oauth_signature", sig);
}
else
{
parameters.Add("api_key", apiKey);
parameters.Add("auth_token", apiToken);
}
var responseXml = UploadData(stream, fileName, replaceUri, parameters);
var t = new UnknownResponse();
((IFlickrParsable)t).Load(responseXml);
return(t.GetElementValue("photoid"));
}