Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

SharePoint 2013

Enable Business Intelligence on any Team Site

Have you worked on a standard SP2013 Team Site then recognized a need to activate BI features.   The BI Center template comes with a lot preloaded.   I used that baseline to compare Activated Features and got the list below.

Running this PowerShell will enable the same features so you can apply BI work to any other base template (Team Site, Community, etc.)   Cheers! 

shades_smile

 

PowerShell

# target
$url = "http://portal/sites/team"

# scope
$webfeat = "PPSMonDatasourceCtype,PPSRibbon,PPSSiteCollectionMaster,PPSWebParts,PPSWorkspaceCtype".Split(",")
$sitefeat = "BICenterDashboardsLib,BICenterDataConnections,BICenterDataconnectionsLib,BICenterDataConnectionsListInstance,BICenterPPSContentPages,BICenterPPSNavigationLink,BICenterPPSWorkspaceListInstance,BICenterSampleData,PPSSiteMaster,PPSWorkspaceList".Split(",")

# activate
foreach ($f in $webfeat) {
	Write-Host "Activating Web - $f"
	Enable-SPFeature -Identity $f -Url $url
}
foreach ($f in $sitefeat) {
	Write-Host "Activating Site - $f"
	Enable-SPFeature -Identity $f -Url $url
}
Write-Host "DONE"

Site Features

PPSMonDatasourceCtype
PPSRibbon
PPSSiteCollectionMaster
PPSWebParts
PPSWorkspaceCtype  

Web Features

BICenterDashboardsLib
BICenterDataConnections
BICenterDataconnectionsLib
BICenterDataConnectionsListInstance
BICenterPPSContentPages
BICenterPPSNavigationLink
BICenterPPSWorkspaceListInstance
BICenterSampleData
PPSSiteMaster
PPSWorkspaceList

Untitled ASPX – light CEWP framing

If you need to host a JavaScript SPA in SharePoint and display on external systems with <IFRAME>.    The below empty ASPX page can host a single Content Editor Web Part to effectively run JavaScript with light framing.  The page loads crazy fast too. 

I created it with SP Designer 2010 (https://www.spjeff.com/2014/05/08/get-design-view-back-on-sharepoint-2013-woohoo/) and WYSIWYG to embed a Web Part Zone and Content Editor above the blank ASPX default page.  

shades_smile

 

Screenshot

 

image
image
image
image

 

Code

<%@ Page Language="C#" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register tagprefix="WebPartPages" namespace="Microsoft.SharePoint.WebPartPages" assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>




None Allows authors to enter rich text content. true 2 Normal true true true true true true true Modeless Default Cannot import this Web Part. /_layouts/15/images/mscontl.gif true 00000000-0000-0000-0000-000000000000 g_73255e0f_a5df_4f4f_a551_8e11741b2e0d /SitePages/Untitled.html

Microsoft wants to hear YOU! UserVoice

The below links are a great way to provide feedback for the Microsoft future roadmap, research & development, and cloud first releases.   Please give feedback and help the community steer in the right direction.   Cheers!  

shades_smile

 

 

 

http://aspnet.uservoice.com
http://bingads.uservoice.com
http://microsoftvisio.uservoice.com
http://msaccess.uservoice.com
http://office365.uservoice.com
http://office365video.uservoice.com
http://officeforms.uservoice.com
http://officemix.uservoice.com
http://officespdev.uservoice.com
http://onedrive.uservoice.com
http://onenote.uservoice.com
http://owa.uservoice.com
http://powerpoint.uservoice.com
http://sharepoint.uservoice.com
http://sway.uservoice.com
http://visualstudio.uservoice.com
http://xbox.uservoice.com
http://binglistens.uservoice.com
http://excel.uservoice.com
http://systemcentervmm.uservoice.com
http://word.uservoice.com

Post to Newsfeed on behalf of another user (Server Object Model)

The below code will post to Newsfeed for any user account you specify.   Activity appears the same as if the user manually posted.   This could be helpful for populating Newsfeed from external activity, custom event receivers, workflow, and other developer sources.   Enjoy! 

shades_smile

 

Screenshot

image

 

Code

using Microsoft.Office.Server.Social;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.SharePoint;
using System;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            // Config
            string siteUrl = "http://mysite";
            string login = "i:0#.w|domain\\user";
            using (SPSite site = new SPSite(siteUrl))
            {
                // Context
                SPUser user = site.RootWeb.SiteUsers[login];
                SPUserToken token = user.UserToken;
                SPServiceContext ctx = SPServiceContext.GetContext(site);

                using (new SPServiceContextScope(ctx))
                {
                    // Init
                    UserProfileManager upm = new UserProfileManager(ctx);
                    UserProfile prof = upm.GetUserProfile(user.LoginName);
                    SPSocialFeedManager mgr = new SPSocialFeedManager(prof, ctx, token);
                    SPSocialPostCreationData post = new SPSocialPostCreationData();

                    // Text
                    post.ContentText = "hello world, look at {0}!";
                    post.UpdateStatusText = true;

                    // Link
                    SPSocialDataItem [] link = new SPSocialDataItem [1];
                    link[0] = new SPSocialDataItem();
                    link[0].ItemType = SPSocialDataItemType.Link;
                    link[0].Text = "My Cool Link";
                    link[0].Uri = new Uri("http://www.google.com");
                    post.ContentItems = link;

                    // Save
                    SPSocialThread thread = mgr.CreatePost(null, post);
                }
            }
        }
    }
}

 

References

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲