7/01/2009

SharePoint: How long is a document or item “New”

 

The default is 2 days (or 1 full day plus time until midnight the next day)

To change the value (you must have admin access to the server):

  stsadm -o setproperty -pn days-to-show-new-icon -pv Number_Of_Days -url http://Your_Server_Address

To check your current value:

  stsadm -o getproperty -pn days-to-show-new-icon -url http://Your_Server_Address

6/27/2009

SharePoint: Redirecting to a page after adding a New item to a list

 

There are times when you want a user to add an item to a list without displaying the list, either before or after they fill out the “New Item” form.

 image

To get them to the form is easy. Go to the list, click the New button and note the URL. Copy the URL and paste it as a link in Quick Launch, an Announcement, a links list or a Content Editor Web Part.

image

When the user clicks your link they will go directly to the New item page. But… when they click OK they will go to the list, not back to your page.

 image

 

The fix is easy...        Add “source=” to the end of the link.

 

1) Go to the list and click the new button. You will see a URL like:

http://www.yourserver.com/sites/sales/Lists/Tasks/NewForm.aspx?RootFolder=%2FLists%2FTasks&Source=http%3A%2F%2Fwww.yourserver.com%2Fsites%2Fsales%2FLists%2FTasks%2FAllItems%2Easpx


2) copy the URL and change the part after Source= to the desired destination. The following will send them back to your home page:

http://www.yourserver.com/sites/sales/Lists/Tasks/NewForm.aspx?RootFolder=%2FLists%2FTasks&Source=http%3A%2F%2Fwww.yourserver.com%2Fsites%2Fsales

 

Absolute or Relative?

Best practice would be to use a relative URL (no HTTP or server name) so your site will work when you have internet and intranet access to the same site. Something like "Source=/sites/sales/" or "Source=/sites/sales/mycustompage.aspx".

To return to the home page add this URL as a link in your Announcement, a links list or a Content Editor Web Part:

Absolute:

http://www.yourserver.com/sites/sales/Lists/Tasks/NewForm.aspx?RootFolder=%2FLists%2FTasks&Source=http%3A%2F%2Fwww.yourserver.com%2Fsites%2Fsales

Relative:

/sites/sales/Lists/Tasks/NewForm.aspx?RootFolder=%2FLists%2FTasks&Source=%2Fsites%2Fsales


In the examples above I did not always escape the slashes:  /  =  %2F
Any slash after the "?" should be escaped.

 

 

Redirect the Cancel Button

One of the questions below notes that the redirect steps above redirect both the OK and the Cancel button to the “Source” URL.  Here’s is a quick pass at adding a “CancelDestination” parameter to the query string to set the destination for the cancel button.

Steps:

  1. Go the “New Item” page
  2. Edit the URL and add “&ToolPaneView=2” to the end of the URL to put the page in edit mode
     
    http://yourserver/sites/sales/Lists/Announcements/NewForm.aspx?RootFolder=%2fsites%2fsales%2fLists%2fAnnouncements&Source=http%3a%2f%2fyourserver%2fsales%2fyoursite&ToolPaneView=2
     
  3. Click “Add a Web Part” and add a Content Editor Web Part (CEWP)
  4. Move the CEWP below the existing list web part
  5. Edit the CEWP and click the Source Editor button
  6. Paste the JavaScript from below
  7. Save your changes and exit the edit mode of the page
  8. Create a URL similar to the one earlier in the article, but add a new parameter named “&CancelDestination=http://yourcanceldestination"
     
    http://www.yourserver.com/sites/sales/Lists/Tasks/NewForm.aspx?RootFolder=%2FLists%2FTasks&Source=http%3A%2F%2Fwww.yourserver.com%2Fsites%2Fsales&CancelDestination=http%3A%2F%2Fwww.yourserver.com%2Fsites%2Fsales%2FCancelPage.aspx
     
  9. Test!

 

The JavaScript:

<script>

var querystring = window.location.search.substring(1);  
var parameters = querystring.split("&");
var QueryString = Array();
for (var i=0;i<parameters.length;i++)
{
  QueryString[parameters[i].split("=")[0]] = parameters[i].split("=")[1];
}
if (QueryString["CancelDestination"] != undefined)
{
  var inputs = document.getElementsByTagName("INPUT");
  for (var i=0; i<inputs.length; i++)
  {
    if (inputs[i].value == "Cancel")
    {
      inputs[i].onclick =
function () {document.location.href = unescape(QueryString["CancelDestination"])}; } } } </script>

 

.

6/24/2009

SharePoint: Removing Group Headings from a View’s Group By

 

When you use grouping in list views SharePoint adds the somewhat redundant field name over and over again for each group heading.

image

Often the group field is pretty obvious. We really don’t need to see Color, Color, Color.

 

To fix this requires SharePoint Designer…

  1. Create the grouped view in the browser as usual
  2. Open the site in SharePoint Designer
  3. Find the view file: “yourname.aspx”
  4. Double-click the file to open it for editing
  5. Display the Code view of the file
  6. Search for GroupByField
  7. Delete all of this text:
    &lt;GetVar Name="GroupByField" HTMLEncode="TRUE"/&gt;&lt;HTML&gt;&lt;![CDATA[&lt;/a&gt; :&amp;nbsp;]]&gt;&lt;/HTML&gt;
  8. Display the Design view and confirm that the change is what you wanted.
  9. Save the file
  10. Test in the site in the browser

Notes:

  • Make sure you get all of the text above, and no more.
  • This will remove all group by headings in the view. You can’t remove just one level.
  • Using SharePoint Designer is always at your own risk!  :-)
  • Remember that you can always right-click an edited file in the folder list and select “Reset to site definition” to undo all of your changes.
  • And finally, this is just a view. You can always delete it are start over.

 

The result should look like this:

image

 

.

6/21/2009

SharePoint: How Microsoft did it…

 

It’s always interesting to see how SharePoint sites have been built. This is especially interesting if you would like to see how to integrate Silverlight with SharePoint.

 

From the Microsoft SharePoint Team Blog: “How We Did It: SharePoint.Microsoft.com”

http://blogs.msdn.com/sharepoint/archive/2009/06/18/how-we-did-it-sharepoint-microsoft-com.aspx

6/14/2009

SharePoint: BigDocumentRepository - Big Document Repository

 

Anybody know what a “Big Document Repository” is?

If you do, leave a comment and let us all know what it is!

 

The only places I can find any references to it are:

SharePoint: A few notes on Excel Services

 

 

Some thoughts on Excel Services

(while I’m thinking about Excel services classes)

 

Audiences? Who needs to know what about Excel Services?

* = any one or all of these people need this knowledge.

  Administrators need to know:

  • Server deployment - SSP, load monitoring and load balancing, session issues
  • Setting up Trusted Locations - and setting timeout, UDF and other options
  • How to deploy custom UDFs (User Defined Functions written in .Net)
  • * Know how to maintain Data Connection Libraries and create Data Connection Files (and understand authentication options)

  Site Owners need to know:

  • Excel and Filter web parts
  • Library "Browser-enabled Documents - Display as a Web page" options
  • Who to ask to know where the "trusted locations" are and which UDFs are installed
  • * Know how to maintain Data Connection Libraries and create Data Connection Files (and understand authentication options)

  End users / Excel developers need to know:

  • What Excel Services is really for, and what the limitations are
  • Which versions of Excel can be used to Publish to SharePoint (only 2007 and only editions above Professional)
  • How to publish to SharePoint
  • Which Excel features will not work in Excel Services (VBA macros for example)
  • How to use custom UDFs written by .Net developers
  • * Know how to create Data Connection Files (and understand authentication options)

  Developers:

  • How to write and deploy UDFs
  • How to call the Excel Server web services (there is no object API!)

 

Links:

Features not supported by Excel Services:
http://msdn.microsoft.com/en-us/library/ms496823.aspx

 

 

.

SharePoint: Microsoft Office can remember your My Site?

 

The following applies to SharePoint 2007.

When you first create a My Site, SharePoint will ask you:

“Microsoft Office can remember your My Site to synchronize documents store here in Outlook and to show it when opening and saving files.”

clip_image002

 

What does that mean? Simply, you’ll get a new shortcut on your file open and save dialog boxes that gives you a direct link to your My Sites site.

clip_image002[6]

 

And if your SharePoint server administrator has added “Published Links to Office client applications” you may find additional links to SharePoint content in file open and save dialog boxes and in data connection dialog boxes.

 

.

6/10/2009

SharePoint: Hide List and Library Column Headings

 

Updated 1/13/2012 with notes for SharePoint 2010

A 2013 version of this article is available here: http://techtrainingnotes.blogspot.com/2015/07/sharepoint-2013-hide-list-and-library.html

I had a request for hiding the column headings of a list displayed in a web part. First thought was the toolbar, but they were asking about the clickable column headings. I think they were wanting to make a page look more like a regular web page instead a page full of lists. By the way this makes for a better way to display a view with only one column…

Note: This will of course remove the ability of the site visitor to sort and filter the web part.

Note: This will also work right in the view page (view pages use web parts!), but in SharePoint 2010 adding a web part to a view page will change how the ribbon gets displayed and will remove the View dropdown menu from the title area crumb trail.

 

Before (2007):

image

After (2007):

image

 

Before (2010):

image

After (2010):

image

Note: after this customization the checkbox column disappears, at least until you mouse over a document. Bug? I think it’s a bonus!

 

Steps:

  • Add your web part for the list to a page
  • For a minimal look set the toolbars to “none”
  • Below this web part add a Content Editor Web Part (CEWP)
    • Modify the CEWP and use the Source Editor button
    • Copy an paste the JavaScript below
    • If the CEWP displays it’s title bar then in the Appearance section set the Chrome to “none”
  • Or (preferred for SP 2010 other than view pages)
    • Copy the JavaScript to a Notepad file (name it something like “HideHeading.html”) and upload this file to a library
    • In the library where you uploaded this file, right-click this file and copy it’s shortcut / url
    • Below your web part add a Content Editor Web Part (CEWP)
    • Modify the CEWP and paste the URL copied above into the Content Link box
    • Save your changes
  • Or (for SharePoint view pages)
    • Edit the view page in SharePoint Designer
    • Copy and paste the Javascript to just before the end tag for PlaceHolderMain (just before </asp:Content>)
  • If you want to hide the column headings of multiple web part modify the IF statement like this Three web parts

Web part summary name!

In SharePoint 2007, the summary name is usually just the list’s name: “Shared Documents”.

In SharePoint 2010, the summary name is usually the list’s name PLUS the list’s description. For example the default for Shared Documents is: “Shared Documents Share a document with the team by adding it to this document library.”  (including the period)

To find the correct name use your browser’s View Source option to display the HTML of the page and search for “summary=” and copy the text that follows.

    <table summary="Shared Documents Share a document with the team by adding it to this document library."

The JavaScript

 

Need to change multiple web parts?

Two web parts:
             if (x(i).summary=="Tasks" | x(i).summary=="Shared Documents"
Three web parts:
             if (x(i).summary=="Tasks" | x(i).summary=="Links" | x(i).summary=="Shared Documents"

The JavaScript

<script type="text/javascript"> // CEWP trick from techtrainingnotes.blogspot.com!

// techtrainingnotes.blogspot.com/2009/06/sharepoint-hide-list-and-library-column.html // Hide column headings in web parts //Find the list (change "Shared Documents" to your web part's name) var x = document.getElementsByTagName("TABLE"); // find all of the Tables var i; var y; for (i=0;i<x.length;i++) { if (x[i].summary=="Shared Documents") //find the table with this name { y = x[i].getElementsByTagName("TR"); y[0].style.display="none"; //hide the first row } } </script>

 

 

.

5/23/2009

SharePoint: The List, the Whole List, Nothing but the List

 

SharePoint does not provide a clean way to display or print just a list or library. It only displays the list inside of the master page and that includes all of the navigation, search and graphics.

Here are a few workarounds:

Here is the goal:

The list, the whole list, nothing but the list (and maybe a crumb trail…)

 

 

There are two ways to do what we need. Plan "A" below is "educational" to let you see how it is all done. Plan "B" is the easiest.

After completing the steps below add a link to this new page in Quick Launch, a links list or as a link from some other page.

 

Plan "A" - Create it all in SharePoint Designer

Open SharePoint Designer
Open your site
Right-click in the Folder List on the project root (the first item in the list: http://yoursite)
Select New and ASPX
Rename the file (JustTheList.aspx, etc)

Double click the new file and select the Design view
Select Insert, SharePoint Controls, Web Part
From the Web Parts pane select your list or library and drag it into the Design View of your new page.
Done... ugly, but a working list only page.
Save it and test in a browser (F12 is the shortcut to open the current page)

Now to make it pretty...

We need the Core.css, and optionally the Theme CSS, CSS files linked to this page. You could manually create the <link> tags, but it's easier to copy what you need from the default.master page.

Add this just above the <html> tag:

<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

Add this somewhere between the <head> and </head> tags:

<SharePoint:CssLink runat="server"/>
<SharePoint:Theme runat="server"/>

If your master page has any custom CSS, add that here too.

Almost there.

Now it looks like a SharePoint list. But it has a title that you may not want and it has the toolbar.

Some properties can be changed from the Design view by right-clicking the web part and selecting Web Part Properties. There you can change most web part properties, except for the view for the list and turning toolbar on or off.

So go ahead and change the title or hide it by setting "Chrome" to none.

To remove the toolbar requires a little code editing.
Display the code view of the page and search for "toolbar".
Change
  Toolbar Type="Standard"
to
  Toolbar Type="None"

Changing the displayed view... Now here's problem. The view is defined by the XSLT embedded in the web part. If you want to pick another view, then it's time for plan "B".

 

Plan "B" - Copy and paste it all...


Open the site in a browser
Go to Site Actions, Create and create a Web Part Page (this is a temporary file, so any name and library will do)
Click Add A Web Part and pick your list or library.
Select Edit, Modify Shared Web part and make all of your customizations.
Click Exit Edit Mode
Open SharePoint Designer
Open your site
Right-click in the Folder List on the project root (the first item in the list: http://yoursite), or select an existing library such as Shared Documents.
Select New and ASPX
Rename the file (JustTheList.aspx, etc)
Double click the new file and select the Design view
In the Folder List browse to the library where you saved the new page and double click the new page to open it
Switch to the Code view and search for "<WebPartPages:ListViewWebPart"
Copy from this start tag to the matching end tag.
Go back to your new page and paste the web part code between the <form> tags.
Save it and test in a browser (F12 is the shortcut to open the current page)

Final cleanup?

  • Add some HTML comments about how you did all of this, or maybe a comment with a link to this artile, so you can fix this up in the future.
  • Find the <title> tags at the top of the page and add a proper title to display at the top of the browser and as the title for Favorites.

And I suppose you want a crumb trail too...
The default crumb trail in the master page looks like this:

<asp:SiteMapPath
    SiteMapProvider="SPContentMapProvider"
    id="ContentMap"
    SkipLinkText=""
    NodeStyle-CssClass="ms-sitemapdirectional"
    runat="server"/>

Strangely this does not display the folders of a library as you drill down using the web part. I tried most of the things I found on the web and none have worked. So as a temporary workaround I created some JavaScript to emulate the crumb trail feature.

JavaScript crumb trail:

<div id="navtrick" class='ms-globalbreadcrumb' style="text-align:left;" ></div>
<script>
fullURL = parent.document.URL
splitURL = fullURL.substring(fullURL.indexOf('?')+1, fullURL.length).split("&")
siteURL = fullURL.substring(0,fullURL.indexOf('?'), fullURL.length)
siteURL = siteURL.substring(0,siteURL.lastIndexOf('/') );
rootURL = fullURL.substring(0,fullURL.indexOf('?')) + "?RootFolder="
path = unescape(splitURL[0].split("=")[1])
folders=path.split("/")
document.all("navtrick").innerHTML = " <a href='" + siteURL + "'>Home</a>"
for (i=1;i<folders.length;i++)
{
  rootURL += "/" + folders[i]
  document.all("navtrick").innerHTML += " &gt; <a href='" + rootURL + "'>" + folders[i] + "</a>"
}
</script>

 

Presented as is… no guarantees… Have fun!

5/22/2009

SharePoint: Service Pack 2 Released - Improved Forms Based Authentication!

Microsoft has just released Service Pack 2 for WSS and MOSS!

Update! SP2 can change your license expiration date! It changes your license to a 180 day evaluation license.

The fix is easy. See here: http://blogs.msdn.com/sharepoint/archive/2009/05/21/attention-important-information-on-service-pack-2.aspx

 


A number of fixes and improvements are listed, but one that stands out to me is that Office itegration now works with Forms Based Authentication (FBA). This has always been a sore spot to anyone using FBA. What I'm not clear on yet is if this only applies to Office 2007... testing will tell.

Update! I’ve tested it and it works! See here for details:

http://techtrainingnotes.blogspot.com/2009/05/sharepoint-with-service-pack-2-sp2.html

 

 

Here's the TechNet articles:

WSS:
http://technet.microsoft.com/en-us/library/cc288043.aspx
MOSS:
http://technet.microsoft.com/en-us/library/cc262201.aspx


Here's the key text (Note comments on Outlook):

If you have not installed Microsoft Office SharePoint Server 2007 with Service Pack 2 (SP2), client integration is disabled by default when you use forms-based authentication. This is because client integration does not natively support forms-based authentication prior to Office SharePoint Server 2007 with SP2. When client integration is disabled, links to client applications are not visible and documents cannot be opened in client applications; documents can only be opened in a Web browser. However, users can download documents, edit them in client applications locally, and then upload them to the site.
If you have installed Office SharePoint Server 2007 with SP2, client integration is supported, except for Outlook integration. All other client integration is supported, including SharePoint Designer authoring.

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.