I am working on developing WinService which uploads photos from specific folder on file system to Facebook page (to have upload, I have made Facebook application and connected it to Facebook page), where folder name is name which will be used for Facebook album. So, first I create album, which is going fine and I have album id.
I have tried several ways to upload photos to Facebook album, but each time one popup notification is generated per each uploaded photo. Way1:
FacebookClient fb = new FacebookClient(token.Trim());
//Perform upload
var imageStream = File.OpenRead(photo.Location);
fb.PostCompleted += (o, e) =>
{
imageStream.Dispose();
if (e.Cancelled || e.Error != null)
{
error = e.Error == null ? "canceled" : e.Error.Message;
}
};
dynamic res = fb.PostTaskAsync("/" + fbAlbumID + "/photos", new
{
message = String.Empty,
file = new FacebookMediaStream
{
ContentType = "image/jpg",
FileName = Path.GetFileName(photo.Location)
}.SetValue(imageStream)
});
res.Wait();
var dictionary = (IDictionary<string, object>)res.Result;
way2:
dynamic result = fb.Batch(
new FacebookBatchParameter(HttpMethod.Post, "/" + albumId + "/photos",
new Dictionary<string, object>
{
{"message", "picture 1 msg"},
{
"pic1",
new FacebookMediaObject {ContentType = "image/jpeg", FileName = "p4.jpg"}.SetValue(
File.ReadAllBytes(
file1path))
}
}),
new FacebookBatchParameter(HttpMethod.Post, "/" + albumId + "/photos",
new Dictionary<string, object>
{
{"message", "picture 1 msg"},
{
"pic2",
new FacebookMediaObject {ContentType = "image/jpeg", FileName = "p4.jpg"}.SetValue(
File.ReadAllBytes(
file2path))
}
}
)
);
but for each way, each uploaded photo has generated popup notification for people who have liked the page. They, "likers", see this as spam.
How to achieve to upload 10 photos in one album and to have single notification?
Please advice, thanks.