Javascript Content Query over Web Applications
Sometimes you want to show some items from a List in another Site Collection or Web Application (or even another Farm). This can't be done with out of the box webparts. The next javascript which you can paste in de default content editor webpart (source editor) can help you in this situation.
-
Go to the site where you want to show your list items (not the location of the list)
-
-
Put this file in a document library in your site
-
-
Edit your page and paste a content editor wepart on your page
-
Go to source editor (of the webpart properties of the content editor webpart)
-
Put the next code into your content editor webpart
<script type="text/javascript" src="http://mysite/documentlibrary/jquery-1.3.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { var soapEnv = "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'> \ <soapenv:Body> \ <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'> \ <listName>libraryname</listName> \ <viewFields> \ <ViewFields> \ <FieldRef Name='Title' /> \ <FieldRef Name='ID' /> \ </ViewFields> \ </viewFields> \ <rowLimit>5</rowLimit> \ </GetListItems> \ </soapenv:Body> \ </soapenv:Envelope>"; $.ajax({ url: http://corporatesite/site/_vti_bin/lists.asmx, type: "POST", dataType: "xml", data: soapEnv, complete: processResult, contentType: "text/xml; charset=\"utf-8\"" }); }); function processResult(xData, status) { $(xData.responseXML).find("z\\:row").each(function() { var liHtml = "<li><a href=\"http://corporatesite/site/list/listname/DispForm.aspx?ID=" + $(this).attr("ows_ID") + "\">" + $(this).attr("ows_Title") + "</a></li>"; $("#tasksUL").append(liHtml); }); }</script>
Collabse Comment Field in Listview
You can collabse the command field of a list view webpart in the following way:
-
Open your page which contains the listview webpart (and the command field) in SharePoint designer
-
Right click the webpart (page is open in SharePoint designer) convert to XSLT Data View in SharePoint designer.
-
Save the page from SharePoint designer
-
Open the page in the browser
-
Choose WebPart properties >> XSL Editor
-
Locate the line: <Xsl:value-of .../> for the V3Comments field
-
Replace the line by:
-
<SharePoint:AppendOnlyHistory runat="server" ItemId="
{@ID}" FieldName="V3Comments" ControlMode="Display" />
-
Apply the changes
Different Templates in SharePoint Document Library
In a lot of situations you want different templates under the new button in a SharePoint document Library:
- Click: "OK"
- Advanced settings >> Add a new document template
- Optionally: You can also choose enter the url (pre requirst the template in already uploaded in a sharepoint document library, you can do this also as step one)
- Connect the new content type to the document library where you want to see the template
- Go to your document library >> Settings >> Advanced Settings
- Mark/check: Allow Management of content types
- Go back to the document library settings (you see lot of more options now since we checked the option allow management of content types)
- Click add from existing site content types
- Select your content type we defined in de first steps of this tutorial (mine is Prince2)
- Click OK
- Optionally you can Change the new button order and default content type (see image above).
- Now users can select the template under the new button in the document library. This could also be other document template types (Excel, PowerPoint etc.)
SharePoint 2010 Starter Masterpage Feature with Mega DropDown Navigation Menu
Last days I played around with Mega Drop Down Menu's. As you can read in Jakob Nielsens article this is "hot" nowadays. By doing some research I came to the Masterpage feature receiver of Mirjam van Olst and a blogpost of Guillaume Marty about Mega Drop Down menus. I put this into a starter masterpage, since this is often the start of (re)branding a site. The Publishing starter masterpage of Randy Risgill is always very helpfull for me (http://startermasterpages.codeplex.com).
I assembled some things into the next Proof of Concept: SharePoint 2010 Starter Masterpage Feature with Mega DropDown Navigation Menu on CodePlex http://sp2010.codeplex.com
At the moment the menu is static. In the next days I will make something more dynamic (you will not need to redeploy your solution for editing the menu content in that situation).
Update: 14 november 2010 --> change content of the Mega Drop Down Menu by a SharePoint List:
If you have any suggestions, feel free to contact me.
Hope this will help lot of people.
Sometimes you can't change the Colum ordering of a list or library
Sometimes the link (in the list or library settings) about the Colum ordering is not visible. If you want to change the column ordering of the SharePoint 2007 Form in that situation you can edit the url e.g. from:
http://my-url/_layouts/listedit.aspx?List=%7B02B1A398%2D7077%2D47AF%2DA455%2D4C4E82C77CC3%7D
to
http://my-url/_layouts/formEdt.aspx?List=%7B02B1A398%2D7077%2D47AF%2DA455%2D4C4E82C77CC3%7D
As you can see you only have to change to part before .apsx from listedit to formEdt.
Cannot Remove WebPart
It could be possible (in some situation) that it is inpossible to delete a WebPart from a Page. E.g. you inserted some javascript in a content editor webpart (HTML view). This Javascript makes the page causing a bug and the page wil return an error (so you can't edit the page). Simply add ?contents=1 after the url: e.g. on the default page http://mysharepointurl/default.aspx?contents=1
Now you can delete the webpart which is causing the error:
Create Master Detail View of Custom Lists using WebPart Connections
Sometimes you want to have to lists, if you click on a record in the one list (e.g. name), you want details about that record (e.g. hollidays from that specific person). One of the options is to use Out of the Box WebPart Connections in SharePoint to realize this.
First I created two custom lists with the follow coloumns:
Custom List: Employees
Custom List: Holliday
-
Next step is to pass this to lists on a webpart page. With the employee list webpart on top.
-
Select Modify Shared WebPart (of the employeelist webpart) > WebPart Connections > Provide Row To > Holliday
In the next screen choose "Last Name"
Now you can select a row from the top (employee) tabel you get details in the bottom (holliday) table
How to get Excel and Powerpoint Button under New Button in SharePoint Document Library
Best you can do this at your top level site (=Site Collection to modify it on all subsites).
-
Go to Settings > Document Library Settings > Advanced Settings
-
Set "Allow management of content types" to Yes
-
Go back to the Document Library Settings
-
Add a new content type by
-
Site Actions > Site Settings > Galleries > Site Content Types
-
Create new content type as in the following image
- Go to Settings > Document Library Settings
- In the section Content types select: "Add from existing site content types"
- Select your Excel Site Content Type (which you just created)
- Modify the URL of an existing document template by:
- Site Settings > Site Content Type > Advanced Settings of the new content type
- Create an empty excel and powerpoint file on your desktop.
- Give this files the names: template.xls and tempate.ppt
- Upload a new document template:
- Select template.xls or .ppt (depending the content type you’re creating).
Do the same for powerpoint. Your document library new settings would look like:
Hide Items in a List View older then a specific date
Sometimes you don't want to delete old files in a document library / list but don't want to show them to the user (because you only want to show up to date items).
You can specify this in the View (Modify Shared Web Part / Modify this View or Modify this View in a Listview) and then navigate to the section filter. If you only want to show items created in the last 30 days (= hide older items then 30 days / one month). You have to apply the following filter:
Note that you can change the numer to your own days.
Missing settings ak menu items in SharePoint 2007 Site Actions Menu
After a SharePoint update (Cummulative Update) I was facing problems with my Site Actions Button. I missed some items as: create and site settings. It was not a security issue since I could load the pages manually by typing the url (e.g. /_layouts/settings.aspx) and I'm in the role of Site Collection Administration.
I faced that my sitecollection was made readonly. This issue could be solved by code or by stsadm.exe
You can change it via code:
Microsoft.SharePoint.Administration.SPSiteAdministration siteAdministration = new SPSiteAdministration(siteCollectionUrl);
siteAdministration.ReadOnly = true;
siteAdministration.Dispose();
Or to remove all locks to the site via STSADM:
stsadm -o setsitelock -url http://servername -lock none