JoelBlogs - Joel Jeffery's Microsoft 365 Blog

Microsoft 365, SharePoint, Teams and Office 365 Architecture, Development, Administration and Training

  • Home
    • Sitemap
  • Articles
    • #SPThingADay
    • SharePoint Online
      • SharePoint Online – Drag and Drop and Large File Uploads
    • SharePoint 2016
    • SharePoint 2013
      • Content Database Changes to the AllUserData Table
    • SharePoint 2010
      • Administration
        • Disable CRL Checking
        • Excel 2010 & PowerPivot
        • Limits & Thresholds
        • PeoplePicker AD Errors
        • Recycle Bin Behaviour
        • Renaming a Server
        • Service Pack 1
        • Unattended Installs
        • Uninstall All SharePoint 2010 Solutions via PowerShell
        • User Alert Management
        • Virtualised SharePoint
        • Visio Stencils for Administrators
      • Development
        • Audience Membership Workflow Activity
        • Base Types, Lists & Content Types
        • BCS & Offline Sync
        • Debugger Skipping Lines
        • Development Laptop Spec
        • Enabling JavaScript IntelliSense
        • Event Receivers & Deployment Jobs
        • FavIcons & SPUrl
        • Google Maps Sandbox Web Part
        • Group By Content Type for List Views
        • Locale Stapler / Master or Default Locale
        • Removing Default Editor Parts
        • Sandbox Embedding Resources
        • Solution Sandbox Introduction
        • SPPersistedObject
        • Restoring Deleted SPSites in SP1
        • SPWebConfigModification 1
        • SPWebConfigModification 2
        • STSADM copyappbincontent vs. Install-SPApplicationContent
        • Workflows for Beginners
        • Workflow InitiationData Seralizer
    • SharePoint 2007
      • Alternate Access Mappings
      • Excel Services
      • Excel Services UDFs & Excel Client 2007
      • Experiences from the Field
      • InfoPath & Forms Server
      • Kerberos & SSRS
      • Records Management
      • Web Application Service
      • WSS vs MOSS
  • Training
    • SharePoint Admin Links
  • Downloads
    • Summary Slides for PowerPoint
    • CodePlex Projects
      • Audience Membership Workflow Activity
      • Google Maps Sandbox Web Part
      • Group By Content Type in List Views
      • Locale Stapler / Master or Default Locale
      • SharePoint Outlook Connector
  • Hire Me!
    • MCP Transcript
    • Résumé/CV

Archives for June 2011

Embedding Resources in Sandbox Solutions

June 30, 2011 by Joel Jeffery

Take One – On Premise SharePoint 2010

When you’re deploying User Code / Sandbox Solutions to the SharePoint 2010 Solution Gallery you may want to include things you’d usually distribute in files under the 14 hive.

One of the chief restrictions in the Sandbox is that you cannot access the file system. One approach is to embed the file as a resource.

To accomplish this, select the file in Visual Studio’s Solution Explorer that you’d like to embed:

Selecting an Embedded Resource

Next, you’ll need a method to retrieve the embedded resource from the compiled assembly (and yes, this works in the Sandbox Smile)

/// <summary>

/// Gets the embedded resource as string.

/// </summary>

/// <param name="filename">The filename.</param>

/// <returns></returns>

private string getEmbeddedResourceAsString(string filename)

{

    string resource = "";

    using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(filename))

        using (StreamReader reader = new StreamReader(stream))

            resource = reader.ReadToEnd();

    return resource;

}

The only slightly tricky part is working out the “filename” of the resource inside your assembly. It’s usually in the form: ProjectName.FolderName.Filename.Ext

In my example, I used the following:

string javaScript = getEmbeddedResourceAsString("GoogleMapsWebPart.GoogleMap.GoogleMap.js");

 

Now I can retrieve the contents of the embedded file and use it without needing to deploy any extra resources.

Take Two – SharePoint Online (Office 365) and On Premise SharePoint 2010

The above method fails in the cloud; Office 365 does not like Assembly.GetExecutingAssembly(), so we need an alternative.

First, you need to add a Resource.resx file. You can do this by right-clicking your Visual Studio project node and going to Properties. Then select the Resources tab, and Add Existing File:

Visual Studio Resources: Add Existing File

From there, navigate to your chosen file you’d like to embed.

You need to change your code to use syntax like: <ProjectName>.Properties.Resources.<ResourceName>.

My example looks like this:

string javaScript = GoogleMapsWebPart.Properties.Resources.GoogleMap;

You can now access your resources directly from your code without any Office 365 Sandbox errors.

Filed Under: SharePoint Tagged With: SharePoint, SharePoint 2010, SharePoint Developer

SharePoint 2010 Service Pack 1 Released Today

June 29, 2011 by Joel Jeffery

Today’s Announcement

After a long wait, SharePoint 2010 SP1 is finally available.

What’s New in Service Pack 1 for SharePoint 2010

SQL Denali Support

Service Pack 1 introduces support for SQL Server Code Name “Denali”.

Shallow Copy

An improvement to the Move-SPSite PowerShell cmdlet, which means that when you move a Site Collection where you’re using the SQL Remote Blob Store for file storage, they can stay right where they are; it’s only database content (such as List, Library and other structure/metadata related content) that gets moved from one database to another.

Caveat: Shallow Copy does not support the Out-of-Box RBS provider (the Filestream Provider).

Site Recycle Bin

SharePoint 2010 SP1 Site Recycle BinMuch awaited, and much appreciated, is inclusion of the new Site Recycle Bin. Before SP1, if you deleted a site, it pretty much stayed that way. Lists, Libraries and Documents got into the Recycle Bin, but not Sites or Site Collections. You could install the free plug-in from Microsoft’s SharePoint Governance site, but it merely archived deleted sites rather than helping those who causally deleted the wrong site.

Storage Space Allocation – Storage Metrics

SharePoint 2010 Storage MetricsIn SharePoint 2010 RTM, Microsoft took away the Storage Management page (storman.aspx).

It’s back now with a new look, showing the top 100 biggest files or containers across a site collection.

Cascading Filters for PerformancePoint Services

A nice touch for Business Intelligence users: filters in PerformancePoint Dashboards can now cascade their values from one to the next.

Browser Support

Service Pack 1 brings support for Internet Explorer 9 (IE9) and IE8 Standards Mode, and now Google Chrome too!

Cumulative Updates

SharePoint 2010 Service Pack 1 includes all the (non-redacted) Cumulative Updates since the RTM:

  • SharePoint Server 2010 April 2011 Cumulative Update
  • SharePoint Foundation 2010 April 2011 Cumulative Update
  • SharePoint Server 2010 February 2011 Cumulative Update
  • SharePoint Foundation 2011 February Cumulative Update
  • SharePoint Server 2010 December Cumulative Update
  • SharePoint Foundation 2010 December 2010 Cumulative Update
  • SharePoint Server 2010 October 2010 Cumulative Update
  • SharePoint Foundation 2010 October 2010 Cumulative Update
  • SharePoint Server 2010 August 2010 Cumulative Update
  • SharePoint Foundation 2010 August 2010 Cumulative Update
  • SharePoint Server 2010 June 2010 updates: KB983497, KB2124512, KB2182938, KB2204024, KB2281364

Filed Under: SharePoint Tagged With: SharePoint, SharePoint 2010, SharePoint Administration, SharePoint Administrator

Next Page »

Joel is a full-stack cloud architect who codes. He is a Microsoft Certified SharePoint Online, SharePoint Server and Azure specialist and Microsoft Certified Trainer.
He has over 20 years' experience with SharePoint and the Microsoft .NET Framework.
He's also co-founder of Microsoft Gold Partner JFDI Consulting Ltd. Read More…

Recent Posts

  • Microsoft Flow Tip #1 – Word Templates and Hiding Empty Repeating Sections
  • SharePoint PowerShell Tip #1 – Select-Object and FieldValues
  • Popular Misconceptions – Microsoft Teams relationship with SharePoint
  • Course: Microsoft 365 Certified Teamwork Administrator
  • Audience Targeted Searches in Modern SharePoint Online
MCT 2020-2021
Microsoft Teamwork Administrator Associate
Joel's Acclaim Profile
Joel's Microsoft Profile

Tags

Administration Architecture Certification Cloud Development freetraining Information Architecture intranets MCP Microsoft Microsoft Architecture Microsoft Azure microsoftsharepoint migration Mobile Development MOSS Office 365 office365 Office 365 Permissions PowerShell SaaS SharePoint SharePoint 2010 SharePoint 2010 Training SharePoint 2013 SharePoint Administration SharePoint Administrator SharePoint Architecture SharePoint Developer SharePoint Development sharepointia SharePoint Online sharepointonline SharePoint Search SharePoint Training SharePoint Videos Silverlight SOA SPThingADay TechEd 2007 Training Videos Windows Phone 7 WSS

Copyright © 2022 Joel Jeffery, SharePoint Architect