Facebook C# SDK Publicar imagen más de una vez

I am uploading or Posting Image to Facebook using Facebook C# SDK but I call this function one time but it uploads the same Image three times or more. It should only upload the Image one time but it does at least three times, I am using 5.4.1 SDK. Code is:

public void AddCover(string accessToken, string imageName, string folder, string loggedinuserId)
{    
    FacebookClient facebookClient = new FacebookClient(accessToken);
    var fbUpl = new Facebook.FacebookMediaObject
    {
        FileName = imageName,
        ContentType = "image/jpg"
    };

    var bytes = System.IO.File.ReadAllBytes(@"F:\Websites\Covers\" + folder + "\\" + imageName); 
    fbUpl.SetValue(bytes);

    var photoDetails = new Dictionary<string, object>();
    photoDetails.Add("message", "Facebook Covers");
    photoDetails.Add("image", fbUpl);
    var response = facebookClient.Post(@"/" + loggedinuserId + "/photos", photoDetails);
    var result = (IDictionary<string, object>)response;
    var postedcoverId = result["id"];

}

Am I missing something here? Please see the code and tell me what I am doing wrong. Thanks

preguntado el 31 de julio de 12 a las 11:07

When are you calling this function? -

after getting the access token, in the end of whole process after this i have to show JqueryUI modal dialogue box to tell user that image has been posted. -

What I meant was, is it in response to an event, such as button click or whatever. -

not its just a void function, I call when I have the access token to pass to it like this. AddCover(accessToken, coverimage, folder, loggedinUserId) I am running this on IIS 6.0 under .Net framework 4.0 -

What calls the void function... -

0 Respuestas

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.