For posting images on FB there are 2 ways:
- FacebookMediaObject
- FacebookMediaStream
Following are the code for FacebookMediaStream.
- var fb = new FacebookClient(pAccessToken);
- string attachementPath = @"C:\\yogesh\\2.jpg";
- using (var file = new FacebookMediaStream
- {
- ContentType = "image/jpeg",
- FileName = Path.GetFileName(attachementPath)
- }.SetValue(File.OpenRead(attachementPath)))
- {
- dynamic result = fb.Post("me/photos",
- new { message = "upload using Facebook SDK for .NET", file });
- }