One interesting sub topic of the group's meeting last night was Layout pages. The scenario was used to showcase approval workflow mentallity of SharePoint, however, I would like to delve deeper into this. Has anyone else had some grand uses of Layout pages? They seem to be a decent replacement for wiki libraries, if you don't need the extra functionality that comes with a wiki page. Please share your thoughts and experiences.
KC Office User Group Meeting: Topic: Layout pages
October 5th, 2007 by chadclarkeCustom Web Part Code: Adding the default doc lib menu to a custom web part
October 1st, 2007 by chadclarkeSo I found a way to add the default drop down menu to the items of a custom web part control. Its pretty convoluted, so if you form a more direct way let me know. See code below:
This Template is needed to be instantiated, but we don't render it… (lil trick)
msaListMenu = new MenuTemplate();
msaListMenu.ID = "DocLibMenu";
I use this menu column to expose multiples values I need for the menu:
SPMenuField msaColMenu = new SPMenuField();
msaColMenu.HeaderText = "Name";
msaColMenu.TextFields = "FileLeafRef, ID, COUID";
//msaColMenu.TextFormat = "{0}/{1}/{2}";
msaColMenu.MenuTemplateId = "DocLibMenu";
//msaColMenu.
msaColMenu.NavigateUrlFields = "FileLeafRef";//Client_x0020_Name_x0020_2";
msaColMenu.NavigateUrlFormat = SPContext.Current.Web.Url+"/[Doc Library Name]/1/{0}";//1
msaColMenu.TokenNameAndValueFields = "EDIT=ID,NAME=Title,TYPE=DocIcon,REF=FileLeafRef";
msaColMenu.SortExpression = "Title";
msaGrid.Columns.Add(msaColMenu);
Javascript I implanted directly after the rendering of the SPGridView Control (this javascript manipulates the menu field that we put in our SPGridView control and gives it the identical html that the default web parts use for their menus:
string transplantMenuFunction = "";
transplantMenuFunction += "<script>
";
transplantMenuFunction += "function transplantMenu(){
";
transplantMenuFunction += " var error;
";
transplantMenuFunction += " try{
";
transplantMenuFunction += " var msaGridView = document.getElementById('" + msaGrid.ClientID + "');
";
transplantMenuFunction += " var spans = msaGridView.getElementsByTagName('span');
";
transplantMenuFunction += " for(var j = 0; j < spans.length; j++){
";
transplantMenuFunction += " if(spans[j].title == 'Open Menu'){
";
transplantMenuFunction += " //t = t+1;
";
transplantMenuFunction += " var valuesString = spans[j].children[0].children[0].children[0].children[0].children[0].innerText;
";
transplantMenuFunction += " var values = valuesString.split('/');
";
transplantMenuFunction += " spans[j].innerHTML = '<table height="100%" cellspacing=0 class="ms-unselectedtitle" onmouseover="OnItem(this)" CTXName="ctx1" Id="'+values[1]+'" Url="" + SPContext.Current.Web.Url + "/" + SPContext.Current.List.Title + "/1/" + "'+values[0]+'" title="" + SPContext.Current.Web.Url + "/" + SPContext.Current.List.Title + "/1/" + "'+values[0]+'" DRef="" + SPContext.Current.Web.Url.Replace(SPContext.Current.Site.Url+"/", "") + "/" + SPContext.Current.List.Title +"/1" + "" Perm="0×7fffffffffffffff" Type="" Ext="" Icon="icgen.gif||" OType="0" COUId="'+values[2]+'" HCD="" CSrc="" MS="0" CType="Item" CId="0×010051390B24CF204947B3B8CFAA6DADB0BF" UIS="512" SUrl=""><tr><td width="100%" Class="ms-vb"><a onfocus="OnLink(this)" href="" + SPContext.Current.Web.Url + "/" + SPContext.Current.List.Title + "/1/'+values[0]+'" ONCLICK="GoToLink(this);return false;" target="_self">'+values[0]+'<!–<IMG BORDER=0 ALT="'+values[0]+'" title="'+values[0]+'" SRC="/_layouts/images/icgen.gif">–></a></td><td><img src="/_layouts/images/blank.gif" width=13 style="visibility:hidden" alt=""></td></tr></table>'
";
transplantMenuFunction += "
";
transplantMenuFunction += " }
";
transplantMenuFunction += " }
";
transplantMenuFunction += " }
";
transplantMenuFunction += " catch(error){
";
transplantMenuFunction += " alert(error.message);
";
transplantMenuFunction += " }
";
transplantMenuFunction += "}
";
transplantMenuFunction += "transplantMenu();
";
transplantMenuFunction += "</script>
";
writer.Write(transplantMenuFunction);
Great resource for the proper way to do things in MOSS 2007
September 28th, 2007 by chadclarkeKnown SharePoint Issue: Switching from inherited to custom permissions!
September 28th, 2007 by chadclarkeSharePoint has a known issue when you're working with the Security of SharePoint. When you are working with the permission in Sharepoint and want to go back and forth between inherited and custom security, MOSS 2007 gets mad. Breaks the entire portal. So if this happens look for this hotfix:
http://support.microsoft.com/kb/937038.
My colleague, Becky Isserman, found this hotfix for us. Her Blog is /mosslover. And Safe Journeys in the world of SharePoint!
Custom Web Part Code: Deleting an Item
September 26th, 2007 by chadclarkeSo this works, but if anyone has any brighter ideas, I have open ears… I was creating a document library web part and had to recreate some of the functionality in the menu… So here is the way I delete and Item…
Declare and initialize a hidden field to store the id of the element to be deleted… hfDeleteDoc
//Server Side Function (C#)
private Boolean deleteDoc(int ID){
try
{
if (msaListName != null && msaListName != "")
{
SPContext.Current.Web.Lists[msaListName].Items.DeleteItemById(ID);
}
return true;
}
catch
{
return false;
}
}
//Server Side Code (C#)
if (hfDeleteDoc.Value != "")
{
int id = Convert.ToInt32(hfDeleteDoc.Value);
deleteDoc(id);
hfDeleteDoc.Value = "";
}
//Server Side Code (C#) Building a javascript function for your menutemplate
string deleteDocFunction = "";
deleteDocFunction += "<script>
";
deleteDocFunction += "function deleteDoc(docID){
";
deleteDocFunction += " var hfDeleteDoc = document.getElementById('" + hfDeleteDoc.ClientID + "');
";
deleteDocFunction += " hfDeleteDoc.value = docID;
";
deleteDocFunction += " document.forms[0].submit();
";
deleteDocFunction += "}
";
deleteDocFunction += "</script>
";
writer.Write(deleteDocFunction);
//Server Side Code (C#) Creating a template for your menu
msaListMenu = new MenuTemplate();
msaListMenu.ID = "MSAListMenu";
MenuItemTemplate msaListMenuItem1 = new MenuItemTemplate("View Properties");
msaListMenuItem1.ClientOnClickNavigateUrl = SPContext.Current.Web.Url + "/MSA/Forms/DispForm.aspx?ID=%EDIT%";
msaListMenu.Controls.Add(msaListMenuItem1);
SPSite tmp = SPContext.Current.Site;
//SPGroup
//SPGroup tmpGrp = SPContext.Current.Web.SiteGroups["Content Managers"];
//tmpGrp.ContainsCurrentUser
MenuItemTemplate msaListMenuItem3 = new MenuItemTemplate("Edit Properties", "/_layouts/images/EDIT.GIF");
msaListMenuItem3.ClientOnClickNavigateUrl = SPContext.Current.Web.Url + "/MSA/Forms/EditForm.aspx?ID=%EDIT%";
msaListMenu.Controls.Add(msaListMenuItem3);
MenuItemTemplate msaListMenuItem4 = new MenuItemTemplate("Delete", "/_layouts/images/DELETE.GIF");
msaListMenuItem4.ClientOnClickScript = "deleteDoc(%EDIT%);";
//msaListMenuItem4.ClientOnClickNavigateUrl = SPContext.Current.Web.Url + "/MSA/Forms/EditForm.aspx?ID=%EDIT%";
msaListMenu.Controls.Add(msaListMenuItem4);
MenuItemTemplate msaListMenuItem2 = new MenuItemTemplate("Alert Me");
msaListMenuItem2.ClientOnClickNavigateUrl = SPContext.Current.Web.Url + "/_layouts/SubNew.aspx?List={49DFCC0E-E021-41F7-9978-1557E1A4B64A}&ID=%EDIT%";
msaListMenu.Controls.Add(msaListMenuItem2);
Become Presence Aware with your WebParts with just an email!
September 19th, 2007 by chadclarkeOkay so I found some great info on this site about presence aware stuff:
http://blogs.msdn.com/modonovan/archive/2005/05/11/416376.aspx
Now, this site exposes a sample CAML for the schema.xml file for a particular list web part… However if you decifer this a bit you will get to the core html for the presence aware feature:
<table>
<tr>
<td>
<table cellpadding="0" cellspacing="0"><tr><td style="padding-right: 3px;"><img border="0" valign="middle" height="16" width="16" src="/_layouts/images/blank.gif" onload="IMNRC('a@b.c')" ShowOfflinePawn=1><td></tr></table>
</td>
<td>
<a href="mailto: a@b.c"> name</a>
</td>
</tr>
</table>
This presence aware html code will allow users to check for an outlook schedule, go to a my site, or see if the target user is online(Microsoft Communicator)… This is a really great feature and its so simple… In your web parts just display render the html to the screen and substitute in an email address and a name. I'm going to use this to make Account Managers presence aware on their clients sites, and when an user search for a client, the results will include the account managers for the client and they will be presence aware. It really is an exciting feature for the clients, they get very excited about it. So test this out on your sharepoint deployment and let me know how you might take advantage of it.
Discussion: MOSS 2007 Conversion from 32-bit Server to a 64-bit Server
September 19th, 2007 by chadclarkeMy client is looking to switch from a 32-bit server to a 64-bit server on both the SQL box and SharePoint box for performance enhancement. We already have a partial portal build in progress. Are there any concerns or red flags that I should point out to him? I believe it should be very simple, back up the 32-bit server's site collection and config db, and simply restore it on the new sharepoint 64-bit server. Any assistance or comments here would be appreciated.
Thanks!
Chad
Discussion: SPSite/Site Collection: Does it contain the permission and features that are inherited to the sites within?
September 19th, 2007 by chadclarkeOr does the root web(site) contain those? If the root web(site) contains holds all of that information, is the SPSite(Site Collection) simply a container for SPWebs(Sites)? I'm interested to see peoples thoughts here. Also, SPSite can not contain SPSites within them, correct?
High Priority ISSUE! MOSS 2007 craziness! Problem!
September 14th, 2007 by chadclarkeOkay, I've got to explain this in a way that translates that shear nonsense that happens here. So I search web part taht search oracle for client ids, brings back the client id and sends it to a redirect page. The redirect page has a web part on it that grabs the client id from the query string and either creates a page for the client if none exists and then ships them to the page, or just sends them to the sharepoint page. On the client's page, There's quite a bit of custom functionality through the use of javascript and custom web parts… The client page is also given a query string "NC_NUMBER=346" to tell the page which client it is so the custom webparts can query oracle for some related info about the client. So thats the scenario. And this works perfectly on my computer and a couple other peoples computers, however, when certain end users try to get the client's page, they get a:
"List does not exist
The page you selected contains a list that does not exist. It may have been deleted by another user. "
Now, this is nuts enough just if it happened when going through the redirect page, however, it does this if you attempt to open a new IE window and paste the url with the nc_number parameter. No redirect involved… AND THEN, check this out, if you go to the site, get the error message, and then hit go back to page, it will load the page no worries.
What seems to occur on the users page, is the sharepoint pulls some query parameters out of no where, one is "Type=List", the other is "name=%7B8B280387%2DF33F%2D4F4F%2D811C%2DF6A4FF8949B6%7D." And of course no list with this guid exists on this site, thus the access denied error message. Now why sharepoint appends these query parameters to the url is a mystery to me.
CAN ANYONE SHED LIGHT ON THIS??? Thanks in advance.
Discussion: AJAX enabling SharePoint – Updated!
September 12th, 2007 by chadclarkeI've done this in a VPC on a single server farm with tutorials I found on google, and I've written various AJAX WebParts for use with sharepoint inside that VPC. I'm looking now for some examples of how people have use this on production systems and if they've had any headaches or problems with any Use Case Scenarios when dealing with SharePoint after its been AJAX enabled. Does all of SharePoint different built in features accept AJAX enabling? I know that there's been talk about Microsoft putting AJAX enabling into SP1, has anyone heard any confirmation of this?
The answer is Yes! However, none of the already existing content of sharepoint is AJAX enabled, but SharePoint after SP1 is installed and configured will accept new controls that are AJAX enabled!
Can't wait for 2009 version which may have AJAX enabling for the entire SharePoint site! Can we say "Enhanced End User Experience"? I think you can! Of course this is just my guess that they will have it out by then…