Welcome! I'm a Microsoft Certified Trainer (MCT) and a SharePoint MVP specializing in SharePoint, .Net, SQL Server and related technologies. I'm a Senior Instructor for MAX Technical Training (Cincinnati area).

You can stay up to date with my blog stuff using Follow TechTrainNotes on Twitter or

Search: or browse by a tag list of contents or browse the newest articles

Looking for a SharePoint user group? Cincinnati SharePoint User Group

1/31/2011

SharePoint 2010 Internet Site Upgrade Watch Out!

 

I was just updating the list of regional SharePoint User Groups on the Cincinnati SharePoint User Group web site. I did a web search for each group, and then clicked the link…

Many of the user group web sites looked to be inactive!

But most likely they had updated from a SharePoint 2007 Team Site to SharePoint 2010 Team Site.

 

SharePoint 2010 Team Sites have two home pages!

 

In SharePoint 2007 Team Sites had a single home page named default.aspx. In 2010 Team Sites have a new home page named Home.aspx that is stored in the SitePages library. But… there is still a default.aspx page in the root of the site.

If you started out with a 2007 site then the search engines indexed your site as http://yourURL/default.aspx. The same is true for most people who bookmarked your site or linked to it from their site or blog. When you upgraded to 2010 your new home page is http://yourURL/sitepages/home.aspx, but most of the links pointing to your site point to /default.aspx.

 

Fix it

 

There are a number of ways to fix this…

  • Add a message to the default.aspx file (using a Content Editor Web Part) that the URL has changed, and please update your links.
     
  • Add some JavaScript to the default.aspx file (using a Content Editor Web Part or SharePoint Designer) that auto redirects to the new home page.
     

.

Cincinnati SharePoint User Group Meeting

 

Next meeting: Thursday February 3, 2011 6:30 PM

 

February's Presentation

Topic: Building an Optimized Internet Business Solution with SharePoint 2010

Abstract: This one hour presentation will cover Microsoft’s Digital Marketing Platform Strategy around: Web Content Management, Social and Web 2.0, Analytics, Commerce, Search and Digital Assets. Using the SharePoint Platform to deliver an adaptive web experience for end-users is a key area of investment for Microsoft to align with the trends in the market and solutions being deployed in various industries.

Presenter: Michele Fiola is a Digital Marketing Platform Specialist with Microsoft, based out of Cleveland. She has been with Microsoft for 6 years as a Solution Specialist focusing on business productivity applications, such as Office and SharePoint. Michele’s 20 year career in the software industry also includes ERP and Plant Floor Automation expertise

Please email point2share@gmail.com for any questions


Meeting agenda

Date:         February 3, 2011, Thursday
Time:         6:00 – 8:00 pm.
Where:       Max Technical Training, 4900 Parkway Dr. #160 Mason, OH. 
                  Click on the link for directions  http://www.maxtrain.com/directions/
Schedule:
6:00 – 6:25 - Socials and Networking - No Registration required
6:25 – 6:30 - Introduction of Agenda and Speakers
6:30 – 8:00 – Presentation

 

.

1/30/2011

SharePoint: Group By on more than 2 columns in a view (SP 2010)

 

This is an update of an article written for SharePoint 2007. Many of the steps are the same in both 2007 and 2010, but both the SharePoint Designer steps and the default web part used for views have changed.

 

Group By on more than 2 columns in a view

In my SharePoint classes I have often been of asked how to group on more than two levels in a view. I have always given the quick answer of "use SharePoint Designer"!

But, some of you have asked "How?". You may be sorry you asked… but here goes…


Goals:

  • Create a view with nested groups deeper than just 2 levels
  • Put the counts and totals at the bottom of each section.
  • Do the above with no custom web parts, custom XSLT or anything that has to be deployed to the server.

Sample:

   image

 

Secrets and Tricks needed:

  • It can't be done "out of the box" in the browser
  • SharePoint Designer is needed to make the edits
  • You need to convert the view web part to a SharePoint Designer Data Form Web Part
  • You need a Sort and Group secret
  • You need to fix the footer rows
  • You need to manually add your totals, averages, counts etc.

Warning!

SharePoint 2010 does not consider a page with a Data From Web Part to be a “view”. It only believes that a page is a “view” when it has an “Xslt List View Web Part”.  In 2007 we could create a new view, edit it in SharePoint Designer as much as we wanted, and it was still a view. In 2010, SharePoint will not recognize a page without a XsltListViewWebPart as a view.

So before you start…

  • If you just need a page with your list nicely grouped, it may be best just to create a web part page and store it in a library.  Then add the Data Form Web Part using the steps below.
     
  • If you want the page to be treated as a view, leave the XsltListViewWebPart on the page, but make it hidden. Then add the Data Form Web Part below the existing web using the steps below.
    • In SP 2010, a view page with an added web part introduces a bug or two. The ribbon will not be displayed. The view dropdown in the page title area will be missing the dropdown to select another view.

 

My Example:

  • I have a simple list (actually imported from Excel) with these columns: ID1, Bike, BikeType, BikeSize, BikeColor and Retail (price).
  • I want to group this on BikeType, BikeSize, BikeColor and count the items and sum or average the price in each group.

 

Create a new Standard View from the list's view menu.  
                Don't bother with any options as we are just going to delete the default list web part. 

               Or just create an empty web part page. (see “Warning” above)


The “before” – just a standard view with selected columns:
     image
 
If using an existing view page:
  • Open your site with SharePoint Designer and click the Lists and Libraries node in the Site Objects pane
  • Click your list (“Bikes” in my example)
  • Click your view you created earlier (“Grouped” in my example)

Otherwise create a new web part page in a library

 

  • Notes (background only, you can skip this):

    • The view is now being displayed using a XsltListViewWebPart  (It was a ListViewWebPart in SP 2007) and can only be customized with the same options as found using a browser ("Modify View")
       
    • The XsltListViewWebPart  has the same grouping limitations and the ListViewWebPart (2 levels of grouping)
       
    • For more info on what has changed from the 2007 ListViewWebPart and the XsltListViewWebPart see http://msdn.microsoft.com/en-us/library/ff806162.aspx and http://msdn.microsoft.com/en-us/library/ff604021.aspx
       
    • SharePoint Designer 2010 has two web parts for lists:
      • XsltListViewWebPart  - this is the web part used when you create a new View
      • DataFormWebPart – created from SharePoint Designer using Insert, Empty Data View
    • SPD 2010 adds a bit of confusion when trying to add a “Data View”
      • When you click Insert, (pick an existing list) SPD inserts an XsltListViewWebPart
      • When you click Insert, Empty Data View SPD inserts a DataFormWebPart
         
         
         
  • If starting with an existing view, delete or hide the existing web part.
    • Delete: In the Design window click in the web part, click the WebPartPages:XsltListViewWebPart tab, press the Delete key
      or
      in the Code window select the entire <WebPartPages:XsltListViewWebPart tag (including the start and end tags) and delete the code
       
    • Hide: In the Design window click in the web part. In the Ribbon in the List View Tools section click the Web Part tab and then click Properties. In the Layouts section of properties click Hidden

     

  • Insert an Empty Data View Web part
    • Click the Insert Ribbon tab and click the Data View button
    • Click Empty Data View
    • In the new web part click “Click here to select a data source”
    • Click your list and click OK (this will open the Data Source Details Pane)
    • Select the columns you want in your list (click a field, then Shift-click each additional field)
    • Click the “Insert Selected Fields as” button and click “Multiple Item View”

     

Note: If you followed the earlier article for SharePoint 2007, the rest of the steps are pretty much the same.

 

Note: the view is now being displayed using a DataFormWebPart and:

  • is no longer a “View” and can not longer be modified from the browser
  • can be customized from SharePoint Designer,
  • from the browser you can only rename the view,
  • from the browser you can also use Site Actions, Edit Page, Modify Shared Web Part to hand edit the XSLT,   ;-) 
  • going forward, columns added to the list will not be automatically added to the DataFormWebPart. You will need to use SharePoint Designer to manually add the columns to the “view’. 

Save! At this point you may want to click Save and review the results so far in a browser. Review the formatting and note the things you need to change. 

  • Edit the Data View Web Part

  • Click the web part and note that you now have Data View Tools section in the SharePoint Designer ribbon.
    image
     
  • Click “Sort and Group”
    image
  • Remove any sort fields that may already be in the Sort Order column


Add your top most group:  

    • Click the field (BikeType) and
    • Click Add
    • Click “Show group header”
    • Click “Collapse group by default” (optional)
    • Click “Show group footer” (if you want counts and totals)

      image

 

Add your second group by clicking the field (Example: Size) and clicking Add.

  • If you stop here you will have groups, but all of your counts and totals will be wrong! We need to create both the text to display for the group and a hierarchy for the grouping. At the second level of our grouping we need to group on the combination of both columns, “Bike Type” plus “Size” 
  • Click “Edit Sort Expression”
     
    • At a minimum you will need to concatenate the current grouping column with the previous grouping columns, and while you are at it you can add some “pretty” formatting:
    • Enter: concat(@Bike_x0020_Type, " - ", @Size)  (Watch the capitalization!  Use the exact name the Intelisense offers – spaces are “coded” so “Bike Type” is “Bike_x0020_Type”.)
    • Note the preview at the bottom of the dialog box…
      image
       
    • Click OK
    • Click Show group header
    • Click Collapse group (optional)
    • Click Show group footer (if you want counts and totals)

  • For the third and following groups - repeat the step above with Sort Expressions similar to:
    • concat(@Bike_x0020_Type, " - ", @Size, " - ", @Bike_x0020_Color)
    • More columns?  In each new group include all of the fields from the previous groups along with any separators you like:
      concat(@group1field, @group2field, @group3field, @group4field, @group5field, etc)
      or concat(@group1field, " - ", @group2field, " - ", @group3field, " - ", @group4field, " - ", @group5field, etc)

    • If you could see the full width of these you would see:
      image 
  • Before clicking OK to leave this dialog box, check the order of the groups. They have probably gotten changed.  (bug?)
    • Make sure they are in order something like:
      @BikeType
      concat(@Bike_x0020_Type, " - ", @Size)
      concat(@Bike_x0020_Type, " - ", @Size, " - ", @Bike_x0020_Color)
    • Recheck each of the sort levels to see if these are still checked:
      • Click Show group header
      • Click Collapse group (optional)
      • Click Show group footer (if you want counts and totals)
  • Optionally add one more column just to sort the data within the last group. Do not turn on the group header or group footer options for this sort-only field.
  • Click OK to close the Sort and Group dialog box.
     
  • You will probably want to change the Paging options as they default to 10 items.  Click the Paging button in the Ribbon (Data View Tools group, Option tab)
     
  • Tip: If you have a lot of data in the list SharePoint Designer can get really slow. There are two things you could do here, set paging to a small number (not so good for testing multi-level grouping) or from the Common Control Tasks select Show With Sample Data.
    image
  • If you want grand totals you will also need to click Data View Properties and check Show View Footer.

  • Save! At this point you may want to click Save and review the results so far in a browser. You should now have all of your groups. 
                             
                Click the + to expand a section.

  • Now is a good time to clean up the formatting such as the gray background and odd row height in the group header and footer rows. (Right-click in the row in Design view and select Cell Properties.

                      (click for bigger view) 
                      image
  • Your grouping work is now done. The following steps are only needed if you want to add totals, counts, averages, etc.

  • Now for totals!
    • These steps describe adding totals to the footer rows, but also apply to modifying header (top of each group) rows.
    • The Data View sets up the header and footer rows as a single cell with a column span of 99! To display totals in the same columns and the data you will need to fix these rows.
    • You will need to fix each of the group footer rows plus the view footer row.
  • In the Code View do a search for "colspan="99"". In my example there will be seven of these, one for each grouping footer, one for each grouping header and one for the view footer.
  • Now you need to do a little planning. In my example I'd like to put the "Count=" in a two column spanned cell under the ID and Bike columns. Then I would like to have one cell under each additional column. So something like: <td colspan='2'>count stuff</td><td></td><td></td><td></td><td>total goes here</td>

    Total boxes

    Steps:
    • Find "colspan="99"" for the first group footer row. (Tip: Did you find a header or footer row? Look up two lines and you should see "<xsl:if test="$showheader"" or "<xsl:if test="$showfooter""!)
    • Change the 99 to 2
    • Find the end tag for the cell (</td>) (down about 16 lines of html)
    • After the end tag add the other cells (TD tag pairs), one for each additional column (I need four more)
      <td></td> <td></td><td></td><td></td>
  • Now to add the total…

    • Switch to Design view and you should see the new cells in one of the footer rows.
    • Click in the cell where you want the total
    • Right-click and select Insert Formula
    • Build your formula. For a total double click "sum" in the function list then select your field from the dropdown list. My example needed: sum(@Retail)
    • The formula editor does not know one extra piece of information needed here. The @Retail field needs to come from the current group only. To get this, update the formula like this: sum($nodeset/@Retail) ("nodeset" is all lower case)
      Tip: How would you have discovered this? Go look at how they calculated the Count: count($nodeset).
    • Notice that the formatting is wrong. The total is left aligned and the wrong size. To match the font and size find the style used for the data in the row above. In my example it looked like this: <TD Class="{$IDADW3HE}">
    • Copy the class info (Class="{$IDADW3HE}") into your total cell (the TD tag). The result will look something like this:
      <td Class="{$IDADW3HE}"><xsl:value-of select="sum(@Retail)" /></td>
    • The last step is to right align the cell (you can use the toolbar button) and to format the total. To format the number, click in the cell with the total, right-click and select Format Item As… and pick your formatting options.
    • Note: SharePoint Designer may get creative and merge your formatting in new styles with great names like style1, style2, style3 etc.. If you are curious, do a search for .style1 (dot style1) and you will find they have placed the style class definition in the PlaceHolderBodyAreaClass master page placeholder.
  • Fix up each footer row, including the View Footer, the same way. Add the extra TDs, add the totals, counts, etc, and format the results.

  • Now about the View Footer… and some things to make your head hurt…


                 image

    • The View Footer is built in its own HTML table, so the column widths are not going to line up with the rest of the list. (I'll have to come back with another article to make these line up correctly).
    • The grand totals need a special calculation to sum all of the rows. The @Retail field (or @yourfield) needs to come from the entire set of rows. To get this, update the formula like this: sum(/dsQueryResponse/Rows/Row/@yourfield) (make sure the capitalization is correct!)
      Tip: How would you have discovered this? Go look at how they calculated the Count for the View Footer: count(/dsQueryResponse/Rows/Row) .

     

       Finally all done!

      A lot of steps, but it's a fairly routine and mechanical process. Do it a few times and you to will be able to amaze your fellow site owners!

      Hopefully the next version of SharePoint (2014?) will support more than two levels of grouping. Then we can all brag: "Back in the old days I had to … "   

       

      BUG!!!

      There is a grouping bug in the Data Form Web Part… read the comments at the end of the original article for details. I hope to revisit that issue for 2010 shortly. If you want to go exploring in the mean time, here’s the fix for 2007.

       

       

      .

      1/29/2011

      SharePoint: Method 'Post' of object 'IOWSPostData' failed - Excel 2010 Excel Import problems

       

      Updated… New version of Office, same old problem!  If you get the IOWSPostData error while trying to import an Excel range into SharePoint, then you need to patch an Excel macro file. The same fix for Office 2007 will also work for Office 2010.

       

      Click here for the updated article…

       

      .

      1/22/2011

      Book Update

       

      Update! The book’s done! 

      See here for the update and here for more about the book.

       

       

      I made a big mistake during my presentation at the Columbus SharePoint Saturday… I mentioned that I was working on a book and that it would soon be available.  What was that about “the best-laid plans of mice and men?” As an instructor I get to teach up to forty hours a week, and each classroom hour requires three to eight hours of prep time. Over the last few months I’ve had a heavy class load and little free time for the book. (I keep letting work get in the way of hobbies and book writing!)

      Several people have been pestering me about “is it out yet?” So let me tell a little about the book and maybe why it’s taking longer than expected.

       

      SharePoint® 2007 and 2010 Customization for the Site Owner

      by Michael T. Smith

       

      There are a lot of books for SharePoint administrators and SharePoint developers, and even a few for SharePoint end users. But there is not much available for the site owner, especially on quick and easy site customization. Over the last five years I have probably trained at nearly a thousand site owners and written a lot blog articles with tips and tricks for site owners. Most of the blog articles were from site owner questions during or after class that really made me think about how to solve the problem without writing custom code. Most of these articles have been fairly short and to the point: add this web part, copy and paste this JavaScript or CSS. Each time I have written one of these blog articles I have wished I had the time to expand the article to explain more about the how and why of the solution, or to explain the logic of how I figured out how to do it so you could create more customizations like the one in the article. So I started writing the book…

      The book has these goals: take what I’ve done in the blog articles as a start and then greatly expand the number of tips and tricks, explain how the tricks work, show how they can be expanded to other uses, and provide a few chapters on basic SharePoint, HTML, CSS and JavaScript skills. The first edition of the book fully supports both SharePoint 2007 and 2010 . If you have not upgraded to 2010 yet, you will one day and will want to know how to make sure these tricks still work.

       

      About the other 80%

      Writing a book fits the 80 / 20 rule. The first 80% of the work takes 80% of the time, and the remaining work also takes 80% of the time.  :-(   My biggest challenge in this project is knowing when to stop. It seems I can always find just one more way to do something, one more trick or one more screen capture. Where possible I’m rewriting each tip to work in SharePoint 2007 and SharePoint 2010, and as often as possible using the same code for both. I’m also adding jQuery versions of some of the examples for those who are already working with jQuery. I’m testing every trick in Internet Explorer 6 to 8 and FireFox and rewriting the JavaScript to work with all of these browsers. (really fun, let me tell ya…)

       

      Book Progress

      Most of the chapters are finished and are now being proof read by some nasty critics. The cover art still needs to be done. The index needs to be created. When all of that is done, the book needs to be submitted and a test copy printed to see if everything “works”, things like margins, images, cover art, etc.

       

      How it will be published

      I don’t see this book ever being finished. There’s just too many things I’m learning about SharePoint everyday. Books published though the traditional channels rarely get updated and I want to update the book as needed. So I am going the “self published” route using a service owned by Amazon.com. It will be first released in print format and I hope to move the book into Kindle and other electronic formats as I get time.

       

      A supporting web site

      The book will have a version number!  (Should I start with a beta release?)  For that and a number of other reasons the book will also have a supporting web site. There you will find all of the source code, a number of the tricks as downloadable web parts along with any new additions. So don’t get upset if you see a version 1.1 of the book after you bought 1.0. The changes will be on the site.

       

      Here’s the current, but still incomplete, table of contents:

      (This will change over the next few weeks…)

       

      + Chapter 1 - Read Me First
      + Chapter 2 - An HTML Primer
      + Chapter 3 - A CSS Primer
      + Chapter 4 - A JavaScript Primer
      + Chapter 5 - Hacking Tips!
      + Chapter 8 - Web Part Must Knows
      + Chapter 9 - The Content Editor Web Part
      + Chapter 10 - User Interface Customization
      + Chapter 11 - List and Library Customization
      + Chapter 12 - Surveys
      + Chapter 13 - Links Lists
      + Chapter 14 - Task Lists
      + Chapter 15 - Calendars
      + Chapter 16 - Security Tricks
      + Chapter 17 - Sound, Video, Silverlight and Flash!

       

       

      Be patient!  I working as fast as I can.    :-)

      1/19/2011

      SharePoint 2010: Site Title and Icon - Change the Font Size, Face or Hide It

       

      Customizing the site title is a bit harder in 2010 than in 2007 as the site title is part of a larger navigation area that includes the title, a "crumb trail" and the View menu. In this article we will look at using CSS to change the font, color or size of the text. Also see here to change how the whole navigation and crumb trail area works.

       

      Here's the home page of a site. "Demo Site" is the name of the site.

        image

       

      The following shows the title, crumb trail and view menu for a library. "Demo Site" is the title, "Shared Documents" is a library and "All Documents" is both the current view and the view dropdown menu button.

        image

       

      Here's a similar site with the view menu clicked:

        image

       

      So as you can see, there a lot of pieces to change to customize the title area in 2010. Now lets take a look at what is required to make the changes for a sample like this one by just using CSS:

        image

       

      You would most likely want to make this kind of change for an entire site rather than a single page by using a master page edit. If you want to make these changes for a single page just add a text file with the CSS to a library, add a Content Editor Web Part and then link to the text file.  You could also just edit this page in SharePoint Designer and add the CSS to the page.

       

      To make your changes available for all pages in your site, add them to the site's master page.

       

      Steps:

      1. Open your site in SharePoint Designer 2010 (see Chapter 6)
      2. In the "Navigation - Site Objects" pane click Master Pages
      3. Right-click your site's master page (typically v4.master) and select "Edit in Advanced Mode"
      4. Search for "</head>" and insert your style block before the </head> tag

                  image

       

      Here are some of the CSS tags to experiment with:

      Changing fonts and colors using CSS

      Each part of the page can be hidden or changed by using a CSS style. Here are the styles and the parts:

      .s4-titlelogo

      clip_image002

      #s4-titlerow

      The entire title row including "I Like It" and "Tags & Notes"

      clip_image004

      .s4-titletext h1 a

      The site title text

      clip_image006

      .ms-WikiPageNameEditor-Display

      Title of any wiki-style page (home page of a Team Site or a page added with "Site Actions, New page"

      clip_image008

      .s4-titletext h2 a

      List/Library name

      clip_image010

      .s4-titletext h2

      Folder name

      #zz17_ListTitleViewSelectorMenu_t

      Current view and view selector

      clip_image012

      #onetidPageTitleSeparator

      The triangles between the items "clip_image014"

      Note: "." indicates a class while "#" indicates an ID

       

      To hide everything after the title:

      <style>
      
      .s4-titletext h2 <!-- everything after the site title -->
      {
      display:none;
      }
      
      #onetidPageTitleSeparator <!-- The triangles between the items -->
      {
      display:none
      }
      
      </style>

       

      Here's a set of sample styles to change the Site Title, the List Name and the View Selector:

      <style>
      
      .s4-titletext h1 a <!-- The site title text -->
      {
      color:Blue;
      font-size:24pt;
      }
      
      .s4-titletext h2 a <!-- list / library name -->
      {
      color:red;
      font-size:18pt;
      }
      
      #zz17_ListTitleViewSelectorMenu_t <!-- current view and menu -->
      {
      color:green;
      font-size:12pt;
      }
      
      </style>

      And here's the page using the above styles:

      image

       

      .

      1/12/2011

      Interesting SharePoint Controls: WarnOnUnsupportedBrowsers

      This is the first of a series of articles on “Interesting SharePoint Controls”. For more controls see here.

       

      <SharePoint:WarnOnUnsupportedBrowsers>

      This control is available only in SharePoint 2010.

       

      The SharePoint 2010 master pages include this control to warn users that they are using an unsupported browser (primarily IE 6). The control is used like this by default:

           <SharePoint:WarnOnUnsupportedBrowsers runat="server"/>

      and displays this:

          image

      “Your Web browser will have problems displaying this web page. Changes to the site may not function properly. For a better experience, please update your browser to its latest version.”

       

      Note to branders and master page editors:  IF your redesigned master page is “IE 6 safe” then delete this control from your master page.

      Interesting… Microsoft added it to v4.master and admin.master, but not to default.master (the 2007 style master) or to minimal.master. 

       

      More info:  (what little there is…)

      http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.warnonunsupportedbrowsers.aspx

       

       

      .

      Interesting SharePoint Controls

      Recently while reviewing a SharePoint 2010 developer class it occurred to me that the class made no mention of any of the SharePoint controls. So as I get the time I’ll write a description and find a sample or two of use for the more interesting controls. I’ll use this page as a “table of contents” for these articles.

       

      These controls are all part of the Microsoft.SharePoint.WebControls namespace.

          http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.aspx 

       

      Here’s the first two:

       

      .

      1/11/2011

      PowerShell to find SharePoint Content Types

       

      A few quick PowerShell scripts…

       

      Find all lists that support a particular content type:

       

      $webs = get-spsite http://yourserver/sites/yoursite | get-spweb 
      
      foreach ($web in $webs) 
      {
      foreach ($lst in $web.lists)
      {
      foreach ($ctype in $lst.ContentTypes)
      {
      if ($ctype.Name -eq "Document")
      { $lst.DefaultViewUrl }
      }
      }
      $web.Dispose()
      }

      (Can be typed as all one line.)

       

      For SharePoint 2007 replace the first line with these three:

          [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

          $site = New-Object Microsoft.SharePoint.SPSite(http://yourserver/sites/yoursite)

          $webs = $site.AllWebs

       

       

      Find all list items of a particular content type:

       

      $webs = get-spsite http://yourserver/sites/yoursite | get-spweb 
      
      foreach ($web in $webs)
      {
      foreach ($lst in $web.lists)
      {
      foreach ($item in $lst.Items)
      {
      if ($item.ContentType.Name -eq "Document")
      { $item.Url}
      }
      }
      $web.Dispose()
      }

      (Can be typed as all one line.)

       

      Get a list of all Content Types in a web:

      $site = Get-SPSite http://yourserver/sites/yoursite
      
      $web = $site.RootWeb
      
      foreach ($ctype in $web.ContentTypes) {$ctype.Name}

      These examples used the content type’s name property. You could also use the ID property.

       

       

      C#

      And for completeness, here’s a C# version to find all lists that support a particular content type:

      using System;
      using Microsoft.SharePoint;
      
      namespace ConsoleApplication6
      {
          class Program
          {
              static void Main(string[] args)
              {
                  SPSite site = new SPSite(http://yourserver/sites/yoursite);
                  
                  SPWebCollection webs = site.AllWebs;
                  foreach (SPWeb web in webs) { 
                      foreach (SPList lst in web.Lists) { 
                          foreach (SPContentType ctype in lst.ContentTypes) { 
                              if (ctype.Name == "Document") {
                                  Console.WriteLine(lst.DefaultViewUrl);
                              } 
                          }
                      }
                      web.Dispose();
                  }
                  site.Dispose();
              }
          }
      }

       

      .

      1/10/2011

      Reading the contents of a SharePoint library file using PowerShell

       

      I recently needed to read the text from a file in a SharePoint library using PowerShell. The only real challenge was converting the return ByteArray into a string. This might be a rare requirement, but just in case someone else might need it.

       

      $site   = Get-SPSite http://yourserver/sites/yoursite
      $web    = $site.RootWeb
      $list   = $web.Lists["Shared Documents"]
      $item   = $list.Items[0]
      $file   = $item.File
      $data   = $file.OpenBinary()
      $encode = New-Object System.Text.ASCIIEncoding
      
      $test   = $encode.GetString($data)

      Yes, it can be done in fewer steps… but for completeness…

       

      For SharePoint 2007 replace the first line with these two:

      [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

      $site = New-Object Microsoft.SharePoint.SPSite("http://yourserver/sites/yoursite")

      1/03/2011

      Cincinnati SharePoint User Group January Meeting

       

      http://www.cincinnatispug.org/

       

      First meeting of the new year for the Cincinnati SharePoint User Group is Thursday January 6th, 2011.

      And if you are in the Dayton area, don’t forget the DAYSPUG meeting on Tuesday January 11th!

       

       

      January's Presentation

      SharePoint 2010 and Business Intelligence

      You’ve got data, probably lots and lots of data across multiple systems. Your end users however want timely access to information to make effective decisions and to monitor and analyze performance. Join us for a high level overview and demonstration of what SharePoint 2010 has to offer end users who have Business Intelligence needs. Topics covered will be:

      • Excel Services
      • PowerPivot
      • Visio Services
      • Reporting Services (SharePoint Integrated Mode)
      • Performance Point Dashboards

       

      Presenter: Tavis Lovell


      Tavis Lovell is a Practice consultant with Ascendum Solutions, specializing in SQL Server (Integration Services, Reporting Services, Analysis Services) and database design related to transactional or BI implementations on the Microsoft stack. Tavis is also involved with using SharePoint 2010 for content delivery as it relates to Business Intelligence. When he’s not trying to help the world make better decisions, he spends his time either pretending he’s Jimi Hendrix, or falling down the sides of mountains on a snowboard

       

      .

      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 been seen.


      ... ---