Dan's Blog

Wednesday, August 9, 2006 - MSN Presence

Posted in Sharepoint

While playing around with the 'Presence Info' in Sharepoint I came across this post by Mark Kruger. Having read it I have now added the same presence information to this blog. If you have Office 2003 Pro (SP2) and MSN/Live Messenger is running you should see my presence information next to the title at the top of this page. I won't explain how it works because Mark has already done that.


Comments (0) :: Permanent Link

Friday, July 28, 2006 - Limit file types in list item attachments

Posted in Sharepoint

To place file type restrictions on list attachments on a per list basis you need to add the OkAttach function from ows.js to the new item and edit item aspx pages for the list in question.

function OkAttach()
{
fileID = FileuploadString + FileUploadIndex;
fileInput = attachmentsOnClient.all(fileID);
filename = TrimWhiteSpaces(fileInput.value);
if (!filename)
{
var L_FileNameRequired_TXT = "You must specify a non-blank value for File Name.";
alert(L_FileNameRequired_TXT);
fileInput.focus();
}
else
{
var L_FileUploadToolTip_text = "Name";
oRow = idAttachmentsTable.insertRow();
RowID = 'attachRow' + FileUploadIndex;
oRow.id = RowID;
oCellFileName = oRow.insertCell();
oCellFileName.className = "ms-vb";
oCellFileName.innerHTML =  filename + "    ";
oCellControl = oRow.insertCell();
oCellControl.className = "ms-propertysheet";
oCellControl.innerHTML = "<.IMG SRC='" + document.all.RectGifUrl.value +
"'> <.a tabindex=1 href='javascript:RemoveLocal(" + RowID + ",\"" + fileID +
"\")'>" + L_Delete_Text + "<./a>";
fileInput.style.display="none";
++FileUploadIndex;
attachmentsOnClient.insertAdjacentHTML("beforeEnd",
"<.input tabIndex=1 type=file class=ms-long name=" +
FileuploadString + FileUploadIndex +
" title=" + L_FileUploadToolTip_text +">");
var theForm = fileInput.form;
theForm.encoding = 'multipart/form-data';
idAttachmentsRow.style.display='block';
ShowPart1();
}
}

Make sure you place the function inside the openning FORM tags and write your restriction code in the top of the ELSE block.


Comments (0) :: Permanent Link

Monday, July 3, 2006 - Display Username

Posted in Sharepoint

Click here to download a small assembly (wcdisplayusername.dll) that can be used to display the currently logged in user's name, login name or both together.

It has been strong named so you can drop it in your GAC and you will not need to raise the trust level in the web.config file. However you will need to add it as a safe control:
ltSafeControl Assembly="WCDisplayUserName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=638bf0fcc8cd630a" Namespace="WCDisplayUserName" TypeName="WCDisplayUserName.DisplayUserName" Safe="True" /gt

Simply register a tag prefix for it on the sharepoint page (this works on both WSS and SPS pages) you want to use it on like so:
lt%@ Register Tagprefix="xx" Namespace="WCDisplayUserName" Assembly="WCDisplayUserName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=638bf0fcc8cd630a"%gt

Put the control where you want it on the page like this:
ltxx:DisplayName DispOption="un" runat="server" /gt
Valid values for DispOption are:
un to display username
ln to display loginname
ul to display username (loginname)

[note]I have had to write lt and gt rather than the actual characters because my blog writing software is a bit rubbish in that it will try and render the contents regardless of how I type them in the source. I'll figure it out sooner or later though[/note]
DAN'S DISCLAIMER
I can not and will not be responsible for any adverse side-effects resulting from the use of any code, programs, assemblies or any thing else that you use or download from my website or this blog. If I say it works I mean that it works on my home PC or on any of the computers that I may have used it on at my place of work.

Comments (0) :: Permanent Link

<- Last Page :: Next Page ->

About Dan's Blog

Dan Iveson
The blog of Dan Iveson. This will contain a mixture of technical articles related to Windows Sharepoint Services, Sharepoint Portal Server, other programming and family stuff.

Recent Posts

- Kite flying
- New Baby
- Nerds!
- MSN Presence
- Kings of Chaos

« January 2009 »
MonTueWedThuFriSatSun
 1234
567891011
12131415161718
19202122232425
262728293031 

Links

- Home
- View my profile
- Visit my website (http://www.daniveson.co.uk)
- Archives
- Friends
- Email Me
- My Blog's RSS
- My Blog's

Friends