SharePoint SharePoint 2007

Replace link with linkable image

I was faced with a challenge the other day of having a linkable image to replace a regular link in my list library view, and here’s how I solved it.

So, I had a list and one of the columns was called “Document Location” which was a link to a document. See below:


The customer wanted the link to be replaced with an image that was linkable to the same document which made it look more presentable.

Here are the steps I took to accomplish this task using a Data View Web Part:

  1. Open up SharePoint Designer

  2. “Ctrl + N” to create a new .aspx page

  3. On the top menu, click “Insert  SharePoint Controls  Web Part Zone”

  4. In your ‘Folder List’ pane, drag and drop your list into the “Web Part Zone” from step 3. If you don’t see the ‘Folder List’ pane, click on ‘Task Panes’ in the top menu and check ‘Folder List’.

  5. Make sure you have the columns showing in your web part zone that you need. To do so, click on the chevron of the web part and click the “Edit Columns” link. Make sure that the column that holds your document location is also on the page.

  6. Right click on any of the fields that appear in the document location column and select “Format item as..”  Picture. If a ‘Confirm’ dialog box appears, click Yes.

  7. Right click on the little x that represents the image that is supposed to be there and select “Picture Properties

  8. In the ‘Picture Properties’ box that appears, under ‘Picture:’, browse to where your image is and select it and click ok. This is the image that will replace the document location link. You should now see your image on the page.

  9. Right click on your image and select “Hyperlink…”

  10. When the “Insert Hyperlink” box appears, clear out the “Address:” window and click on the “fx” button.

  11. When the “More Fields” window appears, select the field that contains the link to your document, in my case, ‘document location’.

You should now have a linkable image like this:


SharePoint 2007

Moving a Sub-Site

At work the other day, I was asked to move 3 sub-sites from one site to another.

I’ve never done this before, so a colleague gave me guidance with the following steps:

‘Site Actions’–>’Manage Content and Structure’–>(Click on the site where sub-site exist)–>(on the right side, check sub-site(s) you want to move)–>’Actions’—>’Move’

The moving of the sub-sites worked like a charm but there was one tiny problem.  When the users would navigate to the old sub-site, it did not redirect them to the new one.  In fact, the old site did not exist anymore because it was moved.

So, how do I solve this issue??  Now the following is not a perfect solution, I don’t even know if it’s good practice but here’s what I did (And I only did it this way because there were only 3 sub-sites to move.  If there were a lot more, I would have looked for another solution).  I followed my colleague’s steps above and when I got to ‘Actions’, I selected ‘Copy’ instead of ‘Move’.

Then, on the pages that I needed to redirect from, I added a CEWP and linked to a JavaScript file with the following code.

<script type=”text/JavaScript”>
var pathName = window.location.pathname; //pathName value: https://myServerDomain/mySite/oldsubsite/Default.aspx
var newPathName = pathName.replace(“oldsubsite”, “newsubsite”);
alert(“Please take note of the new location.  You are now under knowledge Management structure.”);
window.location.replace(newPathName); //newPathName value: https://myServerDomain/mySite/newsubsite/Default.aspx

That was quick and dirty but it worked for what I needed.


CAC Card Implementation in ASP.NET

For those of us that have ever worked for the government, there are times in ASP.NET when you will want to read Common Access Card (CAC) information and use it for authentication in our .NET web applications.  If you have ever wondered how to get CAC information using .NET,
here’s some C# code that shows how to read data from a CAC card​: 


//Get certificate data
HttpClientCertificate cs = Request.ClientCertificate;
string entireSubjectLine = cs.Subject.ToString();

The result of “entireSubjectLine” variable will be the following
C=US, O=U.S. Government, OU=OGC, OU=PKI, OU=CONTRACTOR, CN=LastName.FirstName.MI.1234567890
You should then be able to parse through the “entireSubjectLine” variable to retrieve the data you want to use in your code.  The last number in the “entireSubjectLine” string (1234567890) will be the CAC number which is unique for every CAC.

That was simple.  Happy Coding!