RSS

Category Archives: Code Snippets

Display attachments in sharepoint dataview webpart using sharepoint designer


Use below code to show attachments in sharepoint dataview webpart .

Use this for Single List Item View:

<SharePoint:AttachmentsField ControlMode=”Display” ItemId=”{@ID}” EnableViewState=”true” FieldName=”Attachments”  runat=”server”/>

Use this for Multiple List item Vew:

<SharePoint:AttachmentButton ControlMode=”Edit” Enabled=”true” ItemId=”{@ID}” runat=”server” Visible=”false”/><SharePoint:AttachmentsField ControlMode=”Display” ItemId=”{@ID}” EnableViewState=”true” FieldName=”Attachments” runat=”server”/>

OR

<xsl:element name=”SharePoint:AttachmentsField”>

 <xsl:attribute name=”runat”>server</xsl:attribute>

 <xsl:attribute name=”FieldName”>Attachments</xsl:attribute>

 <xsl:attribute name=”ControlMode”>Display</xsl:attribute>

 <xsl:attribute name=”Visible”>true</xsl:attribute>

 <xsl:attribute name=”ItemId”>

  <xsl:value-of select=”@ID”/>

 </xsl:attribute>

</xsl:element>

NOTE: Please verify double quotes once you copied to sharepoint designer

 
2 Comments

Posted by on August 23, 2009 in Code Snippets, Dataview, Sharepoint Designer

 

Tags: ,

Code Snippet: How to get client machine name?


I had a requirement to get client’s machine name   using smartpart user control in sharepoint . i have tried number of methods but unfortunately those show server name only.

here  is the code which works fine.

Dim host As  System.Net.IPHostEntry

host = System.Net.Dns.GetHostEntry(Request.ServerVariables.Item(“REMOTE_HOST”)) 

Dim strComputerName As String = host.HostName

label1.text= strComputerName

 
1 Comment

Posted by on April 15, 2009 in ASP.NET, Code Snippets, Tips & Tricks

 

Tags: , ,

How to show Outlook INBOX & TASK in sharepoint sites?


Add a Content Editor Webpart  (CEWP) to page and paste the below code.

Inbox

<OBJECT classid=”CLSID:0006F063-0000-0000-C000-000000000046″

 width=”100%”>

  <param name=”Folder” value=”Inbox”>

</OBJECT>

 

Tasks

<OBJECT classid=”CLSID:0006F063-0000-0000-C000-000000000046″

 width=”100%”>

  <param name=”Folder” value=”Tasks”>

</OBJECT>

This is not a perfect solution for showing inbox in portal but a quick and simple tip….Enjoy!

Voila!

 
Leave a comment

Posted by on March 22, 2009 in Code Snippets, Tips & Tricks, Webpart

 

Tags: , , ,