1.29.2013

SharePoint 2010 - Hiding "View All Site Content"

<%-- These styles: Hides the View All Site Content; Makes the Site Actions link white --%>
<!-- Custom Styles -->
<style type="text/css">
 #ctl00_PlaceHolderLeftNavBar_PlaceHolderQuickLaunchBottom_PlaceHolderQuickLaunchBottomV4_idNavLinkViewAllV4 { display:none; }
    .ms-siteactionsmenu .ms-menu-a span { color:#ffffff; }
</style>
<!-- Custom Styles --><


SharePoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl2" runat="server" PermissionsString="ManageLists">
<<SharePoint:SiteActions control>>
</SharePoint:SPSecurityTrimmedControl>


Related Links:
http://www.sharepointkings.com/2008/11/how-to-remove-site-actions-and-view-all.html
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spbasepermissions.aspx

12.20.2012

Drive Cleanup

I am impressed. I was having difficulty connecting my eSATA drive to windows 7. I found this program and it cleared out all old drive references from the registry. http://www.uwe-sieber.de/drivetools_e.html#drivecleanup

12.10.2012

SharePoint Log File Shrinking

Here is a real gem for recovering space taken up by log file growth. It is of course recommended that you back up any files first.

USE SharePoint_Config
GO

ALTER DATABASE SharePoint_Config SET RECOVERY SIMPLE
DBCC SHRINKFILE(N'SharePoint_Config_log', 50)

ALTER DATABASE 
SharePoint_Config SET RECOVERY FULL
GO

12.03.2012

SharePoint 2010 - Setting Up Development Environment

Great whitepaper I found a while ago on setting this up:
https://docs.google.com/open?id=0B4-lBnIxXbzWSmw5MHNuSG1ieGc

11.29.2012

Google+ to RSS

Here are some interesting services for creating RSS feeds of Google+ posts.
  • http://plus-one-feed-generator.appspot.com/
  • http://www.google-plus-rss.com/
  • http://plusfeed.frosas.net/
  • http://pipes.yahoo.com/pipes/
  • http://gplusrss.com/  (Requires you to authorize account access)
  • http://www.makeuseof.com/tag/ways-google-rss-feeds/

CloudCracker

Wow... now this is an interesting service, and scary.
https://www.cloudcracker.com/

11.11.2012

Scheduled Test Print

This is a simple way to send a test print. Place this command in a scheduled task to prevent ink jet cartridges from drying up.

mspaint /p C:\Schedules\Printer\Google.jpg

11.05.2012

Physical to Virtual Migration

Here are some useful tools and instructions for converting a physical windows machine to virtual. This example was used to convert a physical Windows 2003 server to a VHD, which was mounted on a Windows 2012 Hyper-V server.
  1. Run Disk2vhd utility from Microsoft. There are some nuances to this program:
      A) Run the utility from an external drive not being converted.
      B) Make sure to check the Virtual PC option.
  2. Once the .vhd is created, create a new virtual machine and attach the .vhd. Start it up in Hyper-V.
    If the "BOOTMGR is missing" (which is likely)... STOP. 
  3. Dismount the .vhd from Hyper-V at this point and use the following instructions and utilities. There are two options in these instructions for mounting the VHD. I use the process of just mounting the VHD as a drive. This can be done through  Admin Tools --> Computer Management --> Disk Management --> Action --> Attach VHD.
      A)  http://xtralogic.com/testdisk_rebuild_bootsector.shtml
      B)  http://www.cgsecurity.org/wiki/TestDisk_Download
  4. Once the BOOTMGR is fixed, recreate the Hyper-V virtual machine and attach the .vhd.
    Make sure to add the hyper-v extensions/internals to the virtual machine under settings.
  5. Start it up.You will now see multiple boot options, such as:
      A) disk2vhd
      B) Windows Server
  6. Select the Windows Server boot option. You may only have 3 seconds to select this option.
  7. The server may go through many HAL upgrade processes. At some point early on, back up your boot.ini file. Then go into boot.ini and increase the timeout and remove the boot option line related to disk2vhd. http://support.microsoft.com/kb/323427
  8.  If all goes well, you should start seeing drivers and hardware updating. Several restarts may be required.
  9. Once upgrading is completed, go into network properties and configure the IP address, gateway, etc. Confirm that you now have internet connectivity.

10.25.2012

SharePoint 2007 - Hiding Fields w/ Javascript

I actually found this solution to be a bit more elegant, and more compatible with browsers. Just use jQuery and target the ID of the field OR the attribute value.

<script language="javascript" src="https://mysite.company.org/Code/JS/jQuery/jquery-1.8.2.min.js"></script>
<script language="javascript">
// ==================================================================
// JQUERY
// ==================================================================
$(function(){
  //alert("test");
  $("#ctl00_m_g_6a6807bc_96fc_43e6_bfe3_20b1971aadcc_ctl00_ctl04_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_TextField").prop("readonly",true);
   $('input[title="Title"]').prop("readonly",true);

});
</script>


=====================================

Making fields hidden should quite frankly be a built in feature of SharePoint. Here are two interesting tricks I found to modify the NewForm.aspx and EditForm.aspx pages, without opening up SharePoint Desinger.

1) Append this to the URL string. This will force the page edit option. &ToolPaneView=2

2) Add a Content Editor Web Part to the page.

3) Paste this javascript code into the web part.


 <script language="javascript" type="text/javascript">
_spBodyOnLoadFunctionNames.push("hideFields");

function findacontrol(FieldName) {
 var arr = document.getElementsByTagName("!");
 // get all comments
 for (var i=0;i < arr.length; i++ )
 {
 // now match the field name
 if (arr[i].innerHTML.indexOf(FieldName) > 0)
 { return arr[i]; }
 }
}

function hideFields() {
 var control = findacontrol("Title");
 control.parentNode.parentNode.style.display="none";
}
</script>


Sources:

9.28.2012

Google Sites - Sitemap

This just proves I can learn something new every day. I never realized that google sites automatically creates a sitemap feed.

If you created your site using Google Apps, your Sitemap URL is:
http://sites.google.com/a/(your domain)/(site name)/system/feeds/sitemap 
If your site is located at http://sites.google.com/yoursite, your Sitemap URL is:
http://sites.google.com/site/(site name)/system/feeds/sitemap 

9.26.2012

SharePoint 2010 - PowerShell ISE

Run this script to add snap-in automatically to ISE when it starts up.


if (!(test-path $profile )) { 
    new-item -type file -path $profile -force 
} 
 

$cmd = 'if((Get-PSSnapin | Where-Object {$_.Name -eq "Microsoft.SharePoint.PowerShell"}) -eq $null) { 
    Add-PSSnapIn "Microsoft.SharePoint.Powershell" 
}'

out-file -FilePath $profile -InputObject $cmd -Append

Run this script to perform a quick user audit.

$site = Get-SPSite http://yourservername/sites/yoursitecollection
$groups = $site.RootWeb.sitegroups
foreach ($grp in $groups) {"Group: " + $grp.name; foreach ($user in $grp.users) {"  User: " + $user.name} }
$site.Dispose()

Run this script to dump a user audit to a file.

$siteUrl = "http://yourservername/sites/yoursitecollection"
$web = Get-SPWeb $siteUrl

@(foreach ($group in $web.SiteGroups) {
  foreach($user in $group.Users) {
    $usergroup = New-Object System.Object
    $usergroup | Add-Member -type NoteProperty -name GroupName -value $group.Name
    $usergroup | Add-Member -type NoteProperty -name UserName -value $user.Name

     Write-Output $usergroup 
    }
}) | Export-Csv c:\userlist.csv -NoTypeInformation