facebook stream.publish how to upload video

Sep 28, 2010 at 6:10 PM

how do i upload video using stream.publish i have wrote this code, which does makes a status update, but doesn't uploads the video...

 

Facebook.Session.ConnectSession connectsession = new Facebook.Session.ConnectSession(System.Configuration.ConfigurationManager.AppSettings["FBApiKey"].ToString(), System.Configuration.ConfigurationManager.AppSettings["FBApplicationSecret"].ToString());
            connectsession = new Facebook.Session.ConnectSession(appKey, appSecret);            api = new Facebook.Rest.Api(connectsession);            long.TryParse(_sessionKeysplitstr[1], out userId);            api.Session.UserId = userId;            

api.Session.SessionSecret = sessionSecret;  

api.Session.SessionKey = sessionKey;          

   attachment attachment = new attachment();
   attachment.caption = "a test video upload";          

   attachment.name = "I am bursting with joy";                        

    attachment.href = @"C:\inetpub\wwwroot\email.avi";            

attachment.description = "a funny looking cat";                      

 attachment.media = new List<attachment_media>(){new attachment_media_video()                              

     {     video_src = @"C:\inetpub\wwwroot\email.avi",

  video_title = "Email test video",type = attachment_media_type.video,                                      

 preview_img = @"c:\inetpub\wwwroot\nimboo.jpg"  }};           

api.Stream.Publish("a new test for video upload", attachment, null,"XXXXXXXXX", 0);
            connectsession.Logout();