Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8027991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:59:16+00:00 2026-06-04T23:59:16+00:00

Here is the code I’m using to retrieve the current username from SharePoint 2010

  • 0

Here is the code I’m using to retrieve the current username from SharePoint 2010 via Silverlight:

ClientContext clientContext = ClientContext.Current;
if (clientContext == null)
{
    SharepointUser = "[Unknown]";
}
else
{
    MessageBox.Show("Beginning server query now...");
    clientContext.Load(clientContext.Web, s => s.CurrentUser);
    clientContext.ExecuteQueryAsync((s, e) =>
    {
        MessageBox.Show("RESPONSE!");
        SharepointUser = clientContext.Web.CurrentUser.LoginName;
        MessageBox.Show("Hello, " + SharepointUser + "!");
    },
    (s, e) =>
    {
        MessageBox.Show("An error occurred: " + e.ToString());
    });
}

The problem is that the request never comes back! The success/error events don’t trigger at all, and the request just seems like it’s going into the void.

Does anyone have any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T23:59:17+00:00Added an answer on June 4, 2026 at 11:59 pm

    MessageBox.Show is probably the cause of the issue. I was having the same issue and by debugging I found that the calls the MessageBox.Show within the ExecuteQueryAsync callbacks were throwing an exception “Invalid cross-thread access”. I needed to wrap the calls like this to get it to work:

    Deployment.Current.Dispatcher.BeginInvoke(() => MessageBox.Show("Request Suceeded"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is code from MSDN . I don't understand why the work isn't just
here is code for regular expression matching #include<iostream> #include<stdio.h> #include<string.h> using namespace std; int
Here is code from a tutorial in A Byte of Python: import sys filename
Ok the error is showing up somewhere in this here code if($error==false) { $query
Here my code jQuery.fn.dataTableExt.oSort['num-asc'] = function(a,b) { var x = a.replace( /<.*?>/g, ); var
Here sample code: require 'nokogiri' require 'open-uri' begin doc = Nokogiri::HTML(open(url)) rescue puts Fehler
here is code that I have: agent = Mechanize.new page = agent.get 'http://google.com' page.save
Here a code to demonstrate an annoying problem: class A { public: A(): m_b(1),
Here is code example class A{ int i; public: A(int i) : i(i) {}
enter code here Just need to know the basics of peeking in scheme. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.