PerformancePoint Dashboard Render Callback

Doing some JIT branding on a SharePoint 2010 site with bootstrap v2, I needed a way to determine when the PerformancePoint elements on a dashboard had finished loading. PerformancePoint has a problem (or maybe it’s my problem) calculating the width of its components with regard to bootstrap; I fooled it by giving the content area extra margin-left (67px in my case), and then taking it away once all PerformancePoint elements are loaded:

<script type="text/javascript">
    var NotifyBrowserOfAsyncUpdateTimeout = false;

    function NotifyBrowserOfAsyncUpdate(elem) {
        window.console && window.console.log('NotifyBrowserOfAsyncUpdate');
        if (NotifyBrowserOfAsyncUpdateTimeout) {
            clearTimeout(NotifyBrowserOfAsyncUpdateTimeout);
        }
        NotifyBrowserOfAsyncUpdateTimeout = setTimeout(function() {
            // do some stuff
            jQuery('#MSO_ContentTable').css('margin-left', '0');
            window.console && window.console.log('NotifyBrowserOfAsyncUpdateTimeout');
        }, 100);
    }
</script>

I added in the setTimeout/clearTimeout with a nominal 100ms duration, but it probably is not necessary; given some very light testing, by the time the first callback hits, PerformancePoint has correctly calculated the width of its components.

Credit: http://stackoverflow.com/questions/3372565/performancepoint-sharepoint-2010-and-jquery

SharePoint 2010 Secure Store shared service is not responding

When trying to manage the Secure Store Service in SharePoint 2010 I ran into an error stating that the “secure store shared service is not responding…”

ULS logs dumped the following critical error message:

08/30/2013 12:27:50.80	w3wp.exe (0x1AEC)
0x16E8	Secure Store Service
Secure Store
7557
Critical
The Secure Store Service application Secure Store Service is not accessible. The 
full exception text is: The HTTP service located at 
http://localhost:32843/SecurityTokenServiceApplication/securitytoken.svc/actas 
is too busy.
68b1350d-de57-4ee8-922b-19a771c0b31b

After stumbling around google for a while, I came across the following article which suggested that the Security Token service needed to be reprovisioned: http://blogs.msdn.com/b/sowmyancs/archive/2010/07/16/sharepoint-2010-service-applications-bcs-metadata-access-service-are-not-working.aspx

PS C:\Users\uhleeka> Get-SPServiceApplication

DisplayName          TypeName             Id
-----------          --------             --
Secure Store Service Secure Store Serv... a785c55d-74fe-4c36-b3f0-ead5ce920fd0
State Service        State Service        da12d0c8-4455-4ff0-8d78-fafc17495f72
PerformancePoint ... PerformancePoint ... 287024db-317b-4157-b1cf-48fad7997e46
Visio Graphics Se... Visio Graphics Se... e67b7b0b-89c7-413e-97a3-3bdd2181c2e3
Managed Metadata ... Managed Metadata ... 9a407eef-f763-4f8a-a40e-13fcfc731372
Web Analytics Ser... Web Analytics Ser... 9a6bd1b0-3318-4018-b06f-e9bfcbeab042
Excel Services Ap... Excel Services Ap... ae2b3782-8434-4259-8941-de7f6a10e752
Security Token Se... Security Token Se... aea1b402-c567-414a-87ec-de78ef1c050d
Application Disco... Application Disco... aa7cd819-184e-4be3-97ce-bab1ddaa5ccb
Usage and Health ... Usage and Health ... 6c149bc0-1d6f-464a-a191-51afa27e9f89
Search Administra... Search Administra... 9f714436-729e-42ea-a8f0-94cc9f659d7d
Word Automation S... Word Automation S... 5849509b-27bb-4ea3-9377-77261832f58b
User Profile Serv... User Profile Serv... ad8c6f20-4f57-4c6b-82c1-2ff2e4c3894c
Business Data Con... Business Data Con... b352de0b-1bb4-4998-83c2-93d239abcabf
Search Service Ap... Search Service Ap... 14e512ae-59fa-4a21-9cfd-9cfbc7392293


PS C:\Users\uhleeka> $sts = Get-SPServiceApplication | ?{$_ -match "Security"}
PS C:\Users\uhleeka> $sts

DisplayName          TypeName             Id
-----------          --------             --
Security Token Se... Security Token Se... aea1b402-c567-414a-87ec-de78ef1c050d


PS C:\Users\uhleeka> $sts.Status
Online
PS C:\Users\uhleeka> $sts.Provision()

PowerShell to the rescue. Thankx sowmyancs!

SharePoint 2010 SPSecurity.RunWithElevatedPrivileges HandleAccessDenied

The Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges method enables you to supply a delegate that runs a subset of code in the context of an account with higher privileges than the current user.

Using SharePoint context with an unauthenticated user does not actually elevate privileges:

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    // do something with SPContext.Current.Web 
    // fails with a HandleAccessDenied Exception
    // because SPContext is loaded with the site,
    // not within this delegate block.
});

So to get actual elevated privileges, you have to reload the context:

SPSecurity.RunWithElevatedPrivileges(delegate()
{
    using (SPSite site = new SPSite(this.Page.Request.Url.ToString()))
    {
        using (SPWeb thisWeb = site.OpenWeb())
        {
            // do something with thisWeb
        }
    }
});

See here for a better explanation: http://www.danlarson.com/spsecurity-runwithelevatedpriveleges/