SharePoint, PowerShell, .Net and other stuff I spend too much time on...
10/13/2008
SharePoint: "Service Unavailable"
7/23/2008
SQL: Sample CLR function for a Regular Expression validation
Here is a quick example of a .net CLR function to validate any string value using a regular expression. (only works with SQL 2005 and later of course)
1) create a new project using the C# or VB "SQL Server Project" template
2) add a New Item - a function
3) add this code!
using System; using System.Data; using System.Data.SqlClient; using System.Data.SqlTypes; using Microsoft.SqlServer.Server; using System.Text.RegularExpressions; public partial class UserDefinedFunctions { [Microsoft.SqlServer.Server.SqlFunction] public static SqlBoolean RegExpression(string strToTest, string regExpression) { return Regex.IsMatch(strToTest,regExpression); } };
4) Deploy and test!
Samples of how to call:
Test a phone number:
print dbo.RegExpression('223-123-1234','^[2-9]\d{2}-\d{3}-\d{4}$')
Test an email address:
print dbo.RegExpression('abc@maxtrain.com', '^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$')
Test a column of phone numbers:
use AdventureWorks
select phone, dbo.RegExpression(phone,'^[2-9]\d{2}-\d{3}-\d{4}$') as validphone from person.contact
7/19/2008
SharePoint: All about Features - Editing Tips
This article is one of a series. See All about Features! for more.
Tips for editing Features
Features are defined using XML. You can use any editor, but likely candidates include Notepad, Visual Studio, SharePoint Designer and any other XML editor. To edit XML with some form of Intellisense requires an XML schema. SharePoint supplies one named WSS.XSD and it can be found in:
C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\XML\wss.xsd
The wss.xsd schema defines: Feature, Elements, List, Project and Solution.
In many XML editors you register the schema in the editor and then list the schema in the XML tag:
<Feature xmlns="http://schemas.microsoft.com/sharepoint/">
</Feature>
In Visual Studio you can enter the path to the schema file in the Schemas property of the document. Once the editor knows the schema you should get syntax help from your XML editor.
Back to All about Features! for more.
SharePoint: All about Features
All about Features!
All? Not really... Features are one of SharePoint's Swiss Army Knives, something for everybody...
So where to start? Here's a list of topics... the ones that are links are finished and the others will be done one of these days!
- Tips for editing Features
- The feature.xml file
- The elements.xml file
- How to deploy a Feature
- Features to add menu items to SharePoint
- Features to remove items from SharePoint
- Features to add custom controls (using SharePoint Delagate controls)
- Features to run custom .Net code
- Features to deploy files
6/24/2008
SharePoint: Calculated Column Notes
5/07/2008
SharePoint: Create a What's New web part for a library or list (with no programming!)
- Add a web part to the page for the list or library
- From the web part's dropdown menu select "Modify Shared Web Part" and from the properties panel click the "Edit the current view" (just below the "Selected View" dropdown)
- In the Sort section select "Modified" and "descending"
- Expand Folders and select "Show all items without folders" to show all of the documents in the library in a single list
- Expand "Item Limit" and enter the number of items to display
- Optionally select what to do if there are more than that number of items:
- select "Display items in batches" so the users can click next / previous links to page through the data, or
- select "Limit" to display just xx number of items and then display a More link to take the user to the library's page
- Click OK to save the view and click OK to update the web part.
4/12/2008
SharePoint: Turn on more accessible mode???
Try this!
- Go to a SharePoint page using a default master page, your own or a site such as http://www.wssdemo.com/.
- Click as close to the top left corner of the page as possible (just in front of the crumb trail)
- Press Tab - you should now see "Turn off more accessible mode" (if this is does not work, experiment with several tabs or shift-tabs)
What this is supposed to do is change how some navigation controls work. For example, if you are on your own site that has a Welcome menu, click the menu. Instead of a dropdown you will get a new window with all of the choices displayed. If you are testing this with the WSSDEMO site then display a page with a list or library that has an Action menu. Then turn "more accessible" on and click the Action menu. (you may get a warning from your popup blocker)
For more information on accessibility see: Microsoft Active Accessibility (MSAA).
For a great blog article on MOSS accessibility go here: http://www.21apps.com/2007/03/sharepoint-accessibility-is-moss-2007_4974.html
4/02/2008
SharePoint: Web part for a document library folder?
The following is one way to display the folder from a SharePoint library as a web part. While there are other approaches, the goal of the following approach to create this folder display with no code, no custom web parts, no access to the servers and no custom XML or HTML. This approach uses SharePoint Designer to create a new page with a single web part to display the folder. The challenge is not the web part, but displaying just a single folder out of the list. Once the new page has been created you can navigate to the folder and the copy the URL for this page and then use it to display the page in a Page Viewer web part. It of course would be ideal if the library's web part properties included a way to filter by URL or folder.
Create a View
- Go to your document library (Example: Shared Documents)
- Click Settings menu and select Create View
- Click Standard View
- Give the view a name (Example: Folder View)
- Pick the columns to display - Type (icon linked to document) - Name (linked to document with edit menu)
- Limit the number of items displayed by expanding "Item Limit" (Example: 10)
- Click OK to create the view
- Click Site Actions and Edit Page
- Click Add a Web Part
- Add the web part for your library (Example: Shared Documents)
- From the web part's Edit menu select Modify Shared Web Part
- Make these changes:
- Select your newly created view
- Change the Toolbar Type to None (unless you want the tool bar displayed - for exmple, to allow uploads)
- Expand Appearance and
- change Chrome Type to None
- Click OK
- Open SharePoint Designer and open your site
- Scroll down and double-click default.aspx to open your home page - make sure you are displaying the page in Design view (tabs at the bottom of the edit screen)
- Click the web part that's displaying your new view, right-click and select Copy
- Click File, New and select ASPX page
- Rename the page to a useful name such as SharedDocumentsFolderView.aspx
- Double-click the new page to open it in the editor - make sure you are displaying the page in Design view (tabs at the bottom of the edit screen)
- Click in the form box and then right-click and select Paste
- Click File, Save (you can close SharePoint Designer now)
- Open a new browser and navigation to the new page. Probably something like: http://moss.litwareinc.com/sites/testsite/SharedDocumentsFolderView.aspx
- Click on the folder you want displayed. The URL will now look something like:
http://moss.litwareinc.com/sites/testsite/SharedDocumentsFolderView.aspx?RootFolder=%2fsites%2ftest%2fShared%20Documents%2fsub1 &FolderCTID=&View=%7bE0AECBEA%2d20BB%2d4BC3%2d98BC%2dE65D4ADB9DB1%7d - Copy this URL
- Return to a browser and display your web site's home page
- Click Site Actions and Edit Page
- Delete the web part you added earlier for your library
- Click Add a Web Part
- Add the Page Viewer web part
- From this web part click Edit Shared Web Part
- Paste the URL to your new custom page in the Link box
- Change any other properties needed. Most likely are:
- Appearance -> Title Appearance -> Chrome Type
- Appearance -> Height Appearance -> Width
- Advanced -> Title Url (most likely a link to the full library)
- Advanced -> Description
- Click OK
3/28/2008
SharePoint: Site Collection Administrator vs Site Owner (Full Control)
Updated 6/24/09
The words “administrator” and “owner” are a problem in SharePoint due to multiple “official” and “common” uses.
- SharePoint Server (system?) Administrator – responsible for the physical servers, software installation, backup, etc.
- SharePoint Site Collection Administrator – the user responsible for the entire site collection, has access to Site Collection wide features in several places including Site Settings, typically is the person responsible for a department or a group’s entire site collection.
- SharePoint Site Owner – a user with “full control” rights to a single site, it’s lists, libraries and content, and any sub sites and workspaces created below it. I.e. responsible for a “branch” of a site collection.
Here's a list of what the Site Collection Administrator can see that the Site Owner (Full Control user) can not:
Site Actions -> Site Settings
-- Users and Permissions
---- Site collection administrators (only an option when at a top level site)
-- Galleries
---- Workflows
-- Site Administration
---- Content and structure logs
-- The entire Site Collection Administration column is missing
(which also means that the full control user can't access the 2nd level Recycle Bin)
And interestingly enough... we don't trust the Full Control user with all of these features, but they can delete the site!
Here’s the Site Actions –> Site Settings screens…
For the Site Collection Administrator, at a top level site:
(Circled items are not available to the Site Owner)
For the Site Owner, at a top level site:
For the Site Owner, at a sub site you will be missing “Save site as template” and many of the Galleries items:
For sub sites both the Site Collection Administrator and the Site Owner the Galleries column is reduced to these choices.
Also, the “Site collection administrators” link is only available at the top level site.
.
3/24/2008
SharePoint Articles
I have been a bit slow updating this index page, so you may want to take a look at the RSS feed to find the most recent articles: http://feeds2.feedburner.com/TechTrainingNotes
User Group? Cincinnati SharePoint User Group
Articles and links for:
- Site owners and site collection administrators
- Server administrators and anyone involved in planning and deployment
- Developers (code, Features, etc.)
- Customizers (SharePoint Designer, masterpages, CSS tricks, etc
- My SharePoint classes
And for everyone:
For Site Owners and Site Collection Administrators
How To's and Tips
- New! SharePoint: Hiding the Checked Out Icon from Anonymous Users
- New! SharePoint: Strike Out Canceled Events in the Calendar
- New! SharePoint 2010: What’s New in Surveys
- New! SharePoint 2010 Available May 12th?
- New! SharePoint Events in 2010
- New! SharePoint Certification
- New! SharePoint: How to move a Data View Web Part to another site or server
- New! SharePoint 2010: VHDs Now Available – Updated
- New! SharePoint: Application page to display all sites a user can view
- New! SharePoint: How to find all files of a certain type and then download easily
- New! SharePoint: Prevent users from adding “NT AUTHORITY\authenticated users” and other selected accounts to sites and groups
- New! SharePoint: Prevent Accidental Overwrites when Uploading to a Library
- New! SharePoint 2010: What’s the same for Site Owners…
- New! SharePoint 2010: VHDs Now Available
- New! SharePoint: Add a “You are leaving this site” message to a links list
- New! SharePoint: Wiki Search and Replace
- New! SharePoint: DataView Group By Expand / Collapse bug fixed!
- New! SharePoint 2010: Error Messages
- New! SharePoint: List and libraries by SharePoint version (2007 & 2010)
- New! SharePoint 2010: Missing Search Scope Dropdown
- New! SharePoint: Hide a web part with zero rows
- New! SharePoint: Don’t Upgrade to SharePoint 2010!
- SharePoint: Code Snippets in SharePoint Designer!
- SharePoint: Hiding the Search Box
- SharePoint: Missing Content Query Web Part (CQWP)
- SharePoint: Shortcut keys!
- SharePoint: Tricks for web part customizers
- SharePoint: Change the “No Items” message in a discussion web part
- SharePoint: Change the “Add New” message for a web part
- SharePoint: Rotating Pictures, Random Pictures (updated)
- Adding popups to Link lists (open in new window)
- Convert a Links list to a Dropdown list
- Custom Search Boxes – Google Search
- Prevent the rescheduling of a task by dragging of the Gantt chart bar
- File name, folder name and path limits
- Redirecting to a page after adding a New item to a list
- Removing Group Headings from a View’s Group By
- The List, the Whole List, Nothing but the List
- A better Yes/No field for surveys and lists
- Survey Options – Show user names and Allow multiple responses…
- Displaying Pictures and Thumbnails in a Data View Web Part
- Synchronize Document Library Web Part Column Widths
- Locking a Completed Task
- Site Title - Change the Font Size, Face or Hide It
- One library, multiple sites!
- Past Due / Late Tasks in a Task List
- Group By on more than 2 columns in a view
- Color Coding SharePoint Lists
- How to hide the right web part column
- SharePoint Color Coded Calendars! (with no add-ins!)
- Create a What's New web part for a library or list (with no programming!)
- Turn on more accessible mode???
- Web part for a document library folder?
- Site Administrator vs. Site Owner (Full Control)
- Excel 2003 Import and Outlook problems (Method 'Post' of object 'IOWSPostData' failed)
- Using the Calendar to Schedule Meeting Rooms (multiple fields in a month view)
- Hiding Menus (not using HideCustomAction)
- Site collection quotas
- Adding Advanced Search and the All Sites Scope to top level sites
- How does MOSS know the user has InfoPath installed?
- Adding hyperlinks to document libraries
- How do to add a column (meta data) to SharePoint folders
- How to search a Wiki
- InfoPath: Forcing a form to open from SharePoint into a browser
For Server Admins
How To's and Tips
- New! SharePoint: Worst SharePoint Error Message?
- New! SharePoint 2010: SharePoint Server Databases
- New! SharePoint 2010: SharePoint Foundation Databases
- New! SharePoint 2010: Select Template Later!
- New! SharePoint 2010: "the update is not applicable to your computer”
- New! Don’t Upgrade to SharePoint 2010!
- New! SharePoint 2010 Posters (Technical diagrams) Available
- SharePoint: Missing Content Query Web Part (CQWP)
- Hiding Create options from MySite users
- Missing “Save site as template” in sub sites
- Missing web parts on sub sites
- The template you have chosen is invalid or cannot be found
- SharePoint: STSADM notes
- With Service Pack 2 (SP2) Forms Based Authentication and Client Integration Works!
- How to Hide “Delete Site”
- Renaming a Server Breaks SQL Server!
- SharePoint VPCs - Create or download!
- Exploring SharePoint CMP Export Files - And how to restore a single file from the export file!
- How does MOSS know the user has InfoPath installed?
My collections of web resource links
- SharePoint: Links for Forms Based Authentication (FBA)
- New SharePoint Links - Install, Upgrade, Tools
- Assorted New Links - Features, Migration, Management Tools
- SharePoint MOSS Bootcamp notes!
- SharePoint Search Resources
- SharePoint Backup
For Developers
How To's and Tips
- New! SharePoint: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level
- New! SharePoint: Using JavaScript in a Feature CustomAction
- New! Run JavaScript based on user rights / permissions
- New! SharePoint: SafeControl Generator
- New! SharePoint: New VB web part not showing up in Web Part Gallery: New Web Parts (NewDwp.aspx)
- New! SharePoint: List all SPBasePermissions for a User
- New! SharePoint: 2010 Namespace and Assembly Changes
- New! SharePoint 2007: Assemblies and Namespaces
- New! SharePoint 2010: RegistrationId List Template Type IDs
- New! SharePoint: Permission Levels, SPBasePermissions and PermissionMask
- New! SharePoint: Exploring SharePoint CMP Export Files (and a demo application)
- New! SharePoint: The security validation for this page is invalid
- New! SharePoint: SharePoint 2010 Posters (Technical diagrams) Available
- SharePoint: Setting a People Picker field using the API
- Tricks for web part customizers
- Redirecting to a page after adding a New item to a list
- The List, the Whole List, Nothing but the List
- With Service Pack 2 (SP2) Forms Based Authentication and Client Integration Works!
- Displaying Pictures and Thumbnails in a Data View Web Part
- One library, multiple sites!
- Finding SharePoint GUIDs
- View the XML used in SharePoint web parts
- Hiding Menus (not using HideCustomAction)
- SharePoint VPCs - Create or download!
- Exploring SharePoint CMP Export Files - And how to restore a single file from the export file!
- SmallSearchInputBox tip
- How does MOSS know the user has InfoPath installed?
- RegistrationId List Template Type IDs
- SharePoint: Links for Forms Based Authentication (FBA)
- SharePoint developers links
- SharePoint: Resources for customizing 3.0
- SharePoint Search Resources
For Customizers
How To's and Tips- SharePoint: Code Snippets in SharePoint Designer!
- SharePoint: Tricks for web part customizers
- SharePoint: Change the “No Items” message in a discussion web part
- SharePoint: Code Snippets in SharePoint Designer!
- Change the “Add New” message for a web part
- Change SharePoint Fonts and Sizes
- Redirecting to a page after adding a New item to a list
- Redirecting to a page after adding a New item to a list
- The List, the Whole List, Nothing but the List
- Locking a Completed Task
- Site Title - Change the Font Size, Face or Hide It
- Past Due / Late Tasks in a Task List
- Annotated Minimal Master Page
- Group By on more than 2 columns in a view
- Color Coding SharePoint Lists
- How to hide the right web part column
- Color Coded Calendars! (with no add-ins!)
- Create a What's New web part for a library or list (with no programming!)
- Web part for a document library folder?
- Using the Calendar to Schedule Meeting Rooms (multiple fields in a month view)
- Hiding Menus (not using HideCustomAction)
- Adding hyperlinks to document libraries
- How do to add a column (meta data) to SharePoint folders