2

I use the following code to post photos directly to Instagram But it gives error challenge_required. Where do you think the problem is?

        private async void btn_i_s_Click(object sender, EventArgs e)
        {
            var inbox = await ctx.api.MessagingProcessor.GetDirectInboxAsync(PaginationParameters.MaxPagesToLoad(1));
            var threadId = inbox.Value.Inbox.Threads.FirstOrDefault(i => i.Title == txt_u_p.Text).ThreadId;
            OpenFileDialog op = new OpenFileDialog();
            op.ShowDialog();
            var imageUp = new InstaImage()
            {
                Uri = op.FileName
            };
            var image = await ctx.api.MessagingProcessor.SendDirectPhotoAsync(imageUp, threadId);
            if (image.Succeeded)
            {
                MessageBox.Show("Sended ...");
            }
            else
            {
                MessageBox.Show(image.Info.Message);
            }
        }

enter image description here

hadi.aa
  • 43
  • 7

2 Answers2

0

Can this help : Challenge Require?

Suyash Gaur
  • 2,481
  • 2
  • 9
  • 22
0
public static async void EditPorfilePhoto(string Picpath)
{
    var PicByte = File.ReadAllBytes(Picpath);
    var picrequest = await       api.AccountProcessor.GetRequestForEditProfileAsync();
    if (picrequest.Succeeded) 
    {
        var editpic = await api.AccountProcessor.ChangeProfilePictureAsync(PicByte);
        if( editpic.Succeeded)
        {
           Console.WriteLine($"{User.UserName} ProFilePicture Deleted  !."); 
        }
          
    }           
}
Jeremy Caney
  • 7,102
  • 69
  • 48
  • 77
morymory
  • 11
  • 2
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 21 '22 at 02:30