5/22/2011

PowerShell is cool – how many images in a Word document.

 

Problem: How many screen captures do I have in my new book? (Just curious you know…)

The Answer… PowerShell!

A quick Bing and I found this:

http://blogs.technet.com/b/heyscriptingguy/archive/2008/11/13/how-can-i-count-how-many-images-are-embedded-in-microsoft-word-documents.aspx

 

As I only need to check one file, I shortened the code to just this:

image

 

So now I know… I’ve created over 300 screen captures for the new SharePoint® 2007 and 2010 Customization for the Site Owner book.

 

.

5/11/2011

Get Certified Now! (Exams are going to cost more soon…)

 

The primary Microsoft certification exams have cost $125 for a long time now. Starting July 1st they are going up to $150. You can lock in the current pricing for a while, get discounts from your favoriate MCT (10%) or take an exam or two at a 25% discount while you are at TechEd (details) next week! You can also get your exams as part of a certification bootcamp. (here’s two I’m leading: SharePoint Admin and SharePoint Dev)

See here for details: http://borntolearn.mslearn.net/btl/b/weblog/archive/2011/04/22/so-about-that-price-increase.aspx

 

.

4/18/2011

April 20th SharePoint MVP Expert Chat

 

Q&A with the SharePoint MVP Experts Live!

Do you have tough technical questions regarding SharePoint for which you're seeking answers? Do you want to tap into the deep knowledge of the talented Microsoft Most Valuable Professionals? The SharePoint MVPs are the same people you see in the technical community as authors, speakers, user group leaders and answerers in the MSDN and TechNet forums. By popular demand, we have brought these experts together as a collective group to answer your questions live. So please join us and bring on the questions! This chat will cover WSS 3.0, MOSS, SharePoint Foundation 2010 and the SharePoint Server 2010. Topics include setup and administration, design, development and general question.

Please join the MVPs on Wednesday April 20th at 9am PDT or noon EST to chat with MVPs from around the world.  Learn more and add these chats to your calendar by visiting the MSDN event page http://msdn.microsoft.com/en-us/events/aa497438.aspx

 

Twitter hashtag:  #spmvpchat

Facebook Event:  http://www.facebook.com/event.php?eid=185389654840521&pending#!/event.php?eid=185389654840521

SharePoint Team Blog post:  http://sharepoint.microsoft.com/blog/Pages/BlogPost.aspx?pID=969

 

.

Microsoft Office 365 is Now in Public Beta!

 

It’s more than just SharePoint “in the cloud”!  Go take a look, and sign up!

http://www.microsoft.com/en-us/office365/online-software.aspx

 

.

4/16/2011

SharePoint 2010 Menu IDs

 

Menus in 2010? Isn't there a ribbon now?

SharePoint 2010 has ribbons everywhere… except for the Picture libraries and Surveys. Those two lists seem to have been overlooked in the upgrade process. Also the Site Actions button and the Welcome button still display menus and use the same techniques as commonly documented for SharePoint 2007 to hide, show and manipulate these menus.

If you are writing client side JavaScript code to interact with the SharePoint menus you will need to know the IDs of the <ie:menuitem> tags. Below are several tables with some of the IDs used by menu items. Remember that in the SharePoint page these will include a prefix that might look like "zz22_" or “ct100_”.

If the ID you need is not listed in the tables below then view the source of your SharePoint page and search for the name of the menu item (“Edit Page”) or the text "ie:menuitem" until you find the one you need.

  image

You would then find the menu item using JavaScript or jQuery routines such as the examples below. Add the code to a single page using a Content Editor Web Part or SharePoint Designer, or add the code to the master page to impact all pages in the site.

 

JavaScript:

<script type="text/javascript">
 var doc = document.getElementsByTagName('ie:menuitem'); 
 for (var i = 0; i < doc.length; i++)
  {
    itm = doc[i];
    if (itm.id.match('OpenInExplorer') != null)
      {
        itm.hidden=true;
        break; 
      }
  } 
</script>

 

jQuery:

$('ie\\:menuitem[id*=OpenInExplorer]').attr("hidden","true")

The is a list of items created in a typical Team Site home page (v4.master) for the Site Actions and Welcome menus:

Menu ID name

Menu

Menu text

ID_ersonalInformation

The Welcome menu

My Settings

ID_LoginAsDifferentUser

The Welcome menu

Sign in as Different User

ID_RequestAccess

The Welcome menu

Request Access

ID_Logout

The Welcome menu

Sign Out

MenuIItem_EditPage Site Actions Edit Page
MenuItem_TakeOffline Site Actions Sync to SharePoint Workspace
MenuItem_CreatePage Site Actions New Page
MenuItem_CreateDocLib Site Actions New Document Library
MenuItem_CreateSite Site Actions New Site
MenuItem_Create Site Actions More Options…
MenuItem_ViewAllSiteContents Site Actions View All Site Content
MenuItem_EditSite Site Actions Edit in SharePoint Designer
MenuItem_SitePermissions Site Actions Site Permissions

MenuItem_Settings

Site Actions

Site Settings

 

This is a list of menu items created by a picture library view page:

(all of the above table plus the following)

Menu ID name

Menu

Menu text

NewFolder

New

New Folder

     

_Upload (1)

Upload

Upload Document

MultipleUpload

Upload

Upload Multiple Pictures

     

EditPictures

Actions

Edit

DeletePictures

Actions

Delete

DownloadPictures

Actions

Download

SendPictures

Actions

Send To

ViewSlideShow

Actions

View Slide Show

OpenInExplorer

Actions

Open with Windows Explorer

OfflineButton

Actions

Connect to Outlook

TakeOfflineToClient Actions Sync To Computer

ViewRSS

Actions

View RSS Feed

SubscribeButton

Actions

Alert Me

     

AddColumn

Settings

Create Column

AddView

Settings

Create View

ListSettingsMenu_t

Settings

Settings

     

ModifyView

View

Modify this view

CreateView

View

Create view

(1) Prefix the keyword "Upload" with the underline to not confuse with "MultipleUpload"

 

.

SharePoint 2007 Menu IDs

 

If you are writing client side JavaScript code to interact with the SharePoint menus you will need to know the IDs of the <ie:menuitem> tags. Below are several tables with some of the IDs used by menu items. Remember that in the SharePoint page these will include a prefix that might look like "zz22_" or “ct100_”.

If the ID you need is not listed here then view the source of your SharePoint page and search for the name of the menu item (“Edit Page”) or the text "ie:menuitem" until you find the one you need.

     image

You would then find the menu item using JavaScript or jQuery routines such as the examples below:

JavaScript:

<script type="text/javascript">
 var doc = document.getElementsByTagName('ie:menuitem'); 
 for (var i = 0; i < doc.length; i++)
  {
    itm = doc[i];
    if (itm.id.match('OpenInExplorer') != null)
      {
        itm.hidden=true;
        break; 
      }
  } 
</script>

 

jQuery:

$('ie\\:menuitem[id*=OpenInExplorer]').attr("hidden","true")

 

The is a list of items created in a typical WSS Master Page:

Menu ID name

Menu

Menu text

PersonalInformation

The Welcome menu

My Settings

LoginAsDifferentUser

The Welcome menu

Sign in as Different User

RequestAccess

The Welcome menu

Request Access

Logout

The Welcome menu

Sign Out

MenuItem_Create

Site Actions

Create

MenuItem_Settings

Site Actions

Site Settings

MenuIItem_EditPage Site Actions Edit Page

This is a list of items created by a typical document library allitems.aspx page:

(all of the above table plus the following)

Menu ID name

Menu

Menu text

New0 (zero, not O)

New

New Document (default click)

NewFolder

New

New Folder

_Upload (1)

Upload

Upload Document

MultipleUpload

Upload

Upload Multiple Documents

EditInGridButton

Actions

Edit in Datasheet

OpenInExplorer

Actions

Open with Windows Explorer

OfflineButton

Actions

Connect to Outlook

ExportToSpreadsheet

Actions

Export to Spreadsheet

ViewRSS

Actions

View RSS Feed

SubscribeButton

Actions

Alert Me

AddColumn

Settings

Create Column

AddView

Settings

Create View

ListSettings

Settings

Document Library Settings

DefaultView

View

All Documents (in typical library)

View1

View

Explorer View

ModifyView

View

Modify this view

CreateView

View

Create view

(1) Prefix the keyword "Upload" with the underline to not confuse with "MultipleUpload"

 

Unique to a Picture Library

Menu ID name

Menu

Menu text

EditPictures

Actions

Edit

DeletePictures

Actions

Delete

DownloadPictures

Actions

Download

SendPictures

Actions

Send To

ViewSlideShow

Actions

View Slide Show

Lists

Menu ID name

Menu

Menu text

EditInGridButton

Actions

Edit in Datasheet

ExportToDatabase

Actions

Open with Access

 

 

.

SharePoint 2010: Members Can Edit Web Parts and Pages (and how to prevent that)

 

Update… this gets worse in SP 2013! "Members" can create and delete lists and libraries by default! See here.

---

So much of the core of SharePoint 2010 is the same as what we knew in SharePoint 2007 that we are quite surprised when we do run across a really odd change. In SP 2007 members could not edit the home page of the site or modify “shared” web parts.  Unless you removed their permission to do so, they could edit personal views of web parts, but not the shared web parts seen by all users. In SP 2010 site members can not only edit the web parts, but they can edit the home page (home.aspx). And it gets worse…

 

Site Members can even delete the home page!

image

 

Delete your home page? Try it sometime! The result is interesting… (but be safe, don’t try it on a production site)  Sites created from the Team Site template store their “home” page in the Site Pages library as a file named home.aspx. When the home.aspx page gets deleted it goes to the Recycle Bin. The site still works sort of… you will now see a 2007 style web part page that has none of your web parts, text or pictures. It’s the old default.aspx page left over from the 2007 days.

You can recover just fine, just go to the recycle bin and store the page. Click Home in the Top Link Bar and everything is back to normal.

 

The Fix?

Take away some permissions! The problem comes from the fact that wiki pages are stored in a library, and by default users with contributor permissions (site members) have read, write and delete permissions on all libraries. So to fix this little problem we need to take away some permissions on the Site Pages library.

The before and the after:

image  image

 

The before:

image

And the after:

image

 

Steps:

  1. While logged in as a site owner, go to the Site Pages library
  2. Click the Library tab or the ribbon and click Library Settings
  3. Click Permissions for this document library
  4. Click the Stop Inheriting Permissions button in the ribbon and click OK
      image
      image
  5. Checkmark the Members group (and any other groups that need the same change) and click Edit user Permissions 
      image
  6.   Un-checkmark “Contribute”, checkmark “Read” and click OK
      image
  7. Test!

Note: You can undo all of the above by repeating steps 1-3 and clicking Inherit Permissions.

image

 

One more little problem…

We still have New Page in the Site Actions menu.

  image

 

If the contributor user clicks this menu option they will get the dialog box to add a new page, but when they click OK they will get an Access Denied error.

  image

 

How to fix this?

We need to hide the New Page menu item, but only for selected users. This can be done with a little JavaScript and a SPSecurityTrimmedControl.

For more on the SPSecurityTrimmedControl see: http://techtrainingnotes.blogspot.com/2009/07/sharepoint-run-javascript-based-on-user.html

Here’s the JavaScript to hide the menu for selected users:

<script type="text/javascript">
  <!-- assume no is allowed to see the menu option -->
  var userCanSeeNewPage = false;
</script>

<SharePoint:SPSecurityTrimmedControl runat="server" 
  PermissionsString="ManageWeb">
  <script type="text/javascript">
    <!-- users with ViewFormPages can see the menu option -->
    userCanSeeNewPage = true;
  </script>
</SharePoint:SPSecurityTrimmedControl>

<script type="text/javascript">
<!-- Hide the menu option for some users -->
if ( userCanSeeNewPage == false)
{
 var doc = document.getElementsByTagName('ie:menuitem'); 
 for (var i = 0; i < doc.length; i++)
  {
    itm = doc[i];
    if (itm.id.match('MenuItem_EditPage') != null)
      {
        itm.hidden=true;
        break; 
      }
  } 
}
</script>

The first script block just initializes a variable to false to default to hiding the menu option.

The SPSecurityTrimmedControl runs its script block only if the user has the “ManageWeb” permission. That script block just sets the variable to true.

The last script block tests to see if the user should see the menu option, loops through all of the “<ie:menuitem>” tags looking for one with the text “MenuItem_EditPage” in it’s ID and then hides it.

 

Steps:

  1. Open SharePoint Designer and open your master page (most likely v4.master)
  2. Click Edit Page
  3. Scroll down to the end of the master page and just before the “</body>” tag insert the JavaScript from above

Note: The “ManageWeb” permission is generally unique to Site Owners and is one of 32 permissions that can be assigned in SharePoint. There is a list of the permissions strings at the bottom of this article:  http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spsecuritytrimmedcontrol.permissionsstring%28office.12%29.aspx

(These 32 permissions are unchanged from SP 2007)

 

.

4/06/2011

SharePoint Security Testing and Browser Use of Cookies

or… How to really confuse your SharePoint security testing!

 

I was doing some testing with SharePoint security today and was reminded of something I wanted to blog about… browsers and cookies, especially SharePoint session cookies.

 

Sessions

When you log on to SharePoint you establish a session on the web server to keep track of your visit. Without a session you would have to log on for each page load. ASP.NET keeps track of sessions by creating a session ID on the server and storing it in a cookie sent to your browser. This cookie is a temporary cookie and is lost when you close your browser.

 

What if I open a new browser and log in again?

What happens depends on how you open the new browser. The new browser may or may not share cookies from other browser sessions, depending on how you open the browser, and which browser version.

 

For IE 7

In IE 7 there are three ways to open a new browser/page: from the Start button or a desktop icon, from a new tab in the current browser and from the File New menu.

Let’s setup an example:

  1. Open a IE 7 and navigate to a SharePoint site
    • Note the Welcome menu, it’s displaying your Windows credentials (User A)
  2. Click the Welcome menu and sign in as a different user (User B)
    • Note the Welcome menu, it’s displaying your new User B credentials
  3. Click a new tab in the browser and navigate to the same SharePoint site
    • Note the Welcome menu, it’s displaying your User B credentials
  4. Launch a new IE 7 from your Start menu and navigate to the same SharePoint site
    • Note the Welcome menu, it’s back to your Windows credentials (User A)

So in IE 7:

  • Opening a new tab shares the same session
  • Opening a new “window” with File, New Window shares the same session
  • Launching a new browser from the Start button starts a new independent session

 

For IE 6

IE 6 handles sessions the same as IE 7, but does not have tabs.

 

For IE 8

If you repeat the four steps in the IE 7 example you will find that in IE 8 they all share the same session, even if you launch a new browser from the Start menu!

So how can you start a new session?  IE 8 adds a fourth way to open a browser and handles sessions differently than IE 7. Go to the File menu and you will find a new option: File, New Session. This will launch a new session and not share cookies with other IE 8 sessions.

image

 

So in IE 8:

  • Opening a new tab shares the same session
  • Opening a new “window” with File, New Window shares the same session
  • Launching a new browser from the Start button shares the same session
  • Using File, New Session starts a new independent session

This is a big an unexpected change for must IE users.

 

And some things to think about (you do the testing):

  • I open IE 8 and log into a site, I use “File, New Session” and log in to the same site with a different ID, then I go to Start and open a new browser…   Which “session” am I in? (remember opening a new browser shares an existing session)
     
  • I open IE 8 and visit a typical public site.  I then open a new browser (File, New Window or from Start). In the new browser I log into my bank and then close the browser. What happens when I go the first browser and type in the URL to my bank?  (don’t try this on a public PC at the library!)
     

SharePoint Security Testing

If you are testing security, and you want to be sure as to what a “Member” might see that a “Visitor” does not, make very sure that you are really running in a new session.

To ensure a new session:

  • In IE 7 (or IE 6), start a new browser from your Windows Start button (don’t use a new tab or File, New Window)
  • In IE 8 always use File, New Session
  • Use two different PCs (this is the best solution!)
  • Use two different brands of browsers, such as IE and FireFox

How to really confuse your SharePoint security testing!

  1. Log on to your computer as User A (Mike Smith)
  2. In SharePoint click Welcome, Sign in as Different User and login as User B (Sam Conklin)
  3. Perform any operation that uses a local desktop application such as Word, Excel and Windows Explorer

The local applications will be running with your local permissions, and if you are a SharePoint site owner or site collection administrator, then anything goes! Depending on your security setup, your local applications should be prompting for a username and password, but I have seen some that have not. In any case you are thing that your are testing as User B and SharePoint may be seeing you as User A.

 

What about Firefox?

The only copy I have on this PC is 3.6.1.6. It behaves like IE 8 in that I no matter how I open a new browser or window it always shares the same session (shares the cookies). And… it does not even have a File, New Session option!  Even right-clicking the Firefox icon and selecting Run as Administrator shares the same session!

 

FYI… I have not tested Chrome or Safari

 

.

4/05/2011

SharePoint: File Types Supported by Office Web Apps

 

I’ve had a few questions about the files and extensions supported by SharePoint’s Office Web Apps.

 

Quick Notes:

Only Office 2007 and later formats supported: docx, xlsx, pptx, etc.

Cannot create new documents, so dotx, etc not supported

 

Details:

Rather than copy and paste someone else's work, I’ll just give you the link!

http://support.microsoft.com/kb/2028380

 

For features that only work in the full client applications see:

http://technet.microsoft.com/en-us/library/ff431682.aspx

 

.

3/20/2011

If you missed SharePoint Cincy 2011…

 

SharePoint Cincy 2011

If you missed SharePoint Cincy 2011 then you missed out on a full day of everything SharePoint! Two fantastic keynote presentations from Microsoft and Kroger, twenty breakout sessions with speakers from all over the country and a fantastic group of sponsors. I have not forgotten the most important group… the attendees! There was networking and social collaboration going on in every room and around every table.

SharePoint Cincy 2012 – March 16th 2012

Add March 16th, 2012 to your calendar.  Towards the end of the day I was frequently asked “when is this going to be done again?”  During the 5:00 update the SharePoint Cincy team announced that due to the success of this first event that they are going to do it again. So, see you in March 2012.

 

Thanks to the speakers

(Notice how many of these are local talent. The Cincinnati area has a strong base of SharePoint expertise!)

Fred J. Studerstuder, Microsoft Corporation
Catherine AllshouseCatherine, The Kroger Company
Tim Beamer, Dell
Scott Brickey, Strategic Data Systems
Mike Buob, Sogeti, USA
Steve Caravajal, Ph.D., Microsoft Corporation
Bill Crider, Ascendum
Mario Fulan, Information Control Corp (ICC)
Rob Joy, K2
Pat Kern, Procter & Gamble, Global Shared Services
Rob Kerr, BlueGranite
Sean McDonough, Idera
Jonathan Mast, SharePoint 911
Matt Morse, PointBridge
Raveen Rajavarma, Ascendum
Mike Smith, MAX Technical Training
Matthew Tallman, Sogeti, USA
Tom Washek, Microsoft
Eric Weissmann, DSC Consulting
Shane Young, SharePoint 911

Thanks to the sponsors and exhibitors

Without these people the event could not happen…

Ascendum
AvePoint
BrainStorm Inc.
CBTS
Center for Applied Informatics @ NKU
Dell
Information Control Corporation
K2
MAX Technical Training
Microsoft
PCMS IT Advisor Group
SDS - Strategic Data Systems
Sogeti
The Circuit

The Cincinnati SharePoint User Group
The Dayton SharePoint User Group

 

.

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.