10.17.2013

SharePoint 2010 - Metatag Visibility Access

By default it would appear that the taxonomy information is not readily visible to all users, outside of the administrator. This list hidden list requires the following permissions:
https://servername/Lists/TaxonomyHiddenList/
  • NT AUTHORITY\authenticated users           Read  
  • System Account (SHAREPOINT\system)     Full Control 

10.16.2013

SharePoint 2010 - InfoPath Time Picker

Creating a time picker in InfoPath is a real pain. I opted to not create the sharepoint lists and just load the options manually within the form. To pull this off you need to create 4 fields.
  1. MyDateTime = DateTime control. The final location of the information. Not actually used in the form. Just a container for storage.
  2. mDatePicker = Date control.
  3. mHourPicker = Text box in drop down format. Options are 00 - 23.
  4. mTimePicker = Text box in drop down format. Options are 00,15,30,45.
The concatenation used to apply the final value to MyDateTime is actually this, not what was in the article.
concat(mDatePicker, “T”, mHourPicker, “:”, mMinutePicker, “:00″)

This article does explain it quite well.
http://www.moderntoad.com/2012/02/23/infopath-date-hour-and-minute-picker-to-replicate-sharepoint-experience/

9.30.2013

SharePoint 2010 - Chrome Compatibility Fix

This little gem works really well at getting Chrome to load javascript correctly. IE8 does not like this and will throw an error.

<!--[if !IE]><!-->
<script type="text/javascript">
   window[addEventListener ? 'addEventListener' : 'attachEvent'](addEventListener ? 'load' : 'onload', function(){
    if(_spBodyOnLoadWrapper){
      _spBodyOnLoadWrapper();
    }
   });
</script>
<!--<![endif]--> 


http://royaltutorials.com/sharepoint-2010-javascriptribbon-not-working-in-chrome/
http://withinsharepoint.com/archives/256

9.27.2013

SharePoint 2010 - Javascript Client Object Model

The following working example uses Javascript, JQuery, and CAML.

 http://msdn.microsoft.com/en-us/library/jj245759.aspx
 http://www.sharepointnutsandbolts.com/2010/10/sp2010-ajaxpart-2-using-javascript.html

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

<div style="padding: 20px;">
<hr />
<h3>
Calculate Total Subs Reserved for a Single Day (Pending/Approved)</h3>
<table border="0" cellpadding="0" cellspacing="4">
  <tbody>
<tr>
    <td height="55"><input class="input-small search-query" id="targetDay" maxlength="10" name="targetDay" placeholder="YYYY-MM-DD" style="font-size: 150%;" type="text" /></td>
    <td width="80"><button class="btn btn-primary" id="btnGo" type="button">GO</button></td>
    <td width="200"><div id="totalSubsResults" style="color: red; font-weight: bold;">
</div>
</td>
  </tr>
</tbody></table>
<hr />
</div>
<script type="text/javascript">
    var allDocs;
    var GUIDSubStartDate = "_a3909a47_509a_47e3_a9e7_2e149c274379";
    var GUIDSubEndDate = "_fa7b1c2e_5d62_4edc_a3bd_aa41c9da2003";
    var GUIDSubNumber = "_c0232d29_8c9c_4c08_bf02_3ade22e7d14f";


    $('#btnGo').click(function () {
        SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);
    });
    
    
      function sharePointReady() {
        //var currentDay = '2013-10-23'
        var currentDay = $('#targetDay').val();
        
        //var ctx = new SP.ClientContext.get_current();
        var ctx = new SP.ClientContext;
        var targetList = ctx.get_web().get_lists().getByTitle('PDR');
        
        //var query = SP.CamlQuery.createAllItemsQuery();
        //allDocs = targetList.getItems(query);
        //ctx.load(allDocs);
        
        var query = new SP.CamlQuery();
        query.set_viewXml("<view><query><where><and><neq><fieldref Name='ApprovalStatus' /><value Type='Choice'>REJECTED</Value></Neq><and><leq><fieldref Name='" + GUIDSubStartDate + "' /><value IncludeTimeValue='FALSE' Type='DateTime'>" + currentDay + "</Value></Leq><geq><fieldref Name='" + GUIDSubEndDate + "' /><value IncludeTimeValue='FALSE' Type='DateTime'>" + currentDay + "</Value></Geq></And></And></Where></Query></View>");

        allDocs = targetList.getItems(query);
        ctx.load(allDocs);
        ctx.executeQueryAsync(Function.createDelegate(this, getDocsAllItemsSuccess),  Function.createDelegate(this, getDocsAllItemsFailure));
    }


    function getDocsAllItemsSuccess(sender, args) {
        var totalSubsNumber = 0;
        var listEnumerator = allDocs.getEnumerator();
        // Loop Over Records ------------
        while (listEnumerator.moveNext()) {
            var mySubsNumber = listEnumerator.get_current().get_item(GUIDSubNumber);
            //$('#detailsSubResults').append(mySubsNumber + '<br />');
            totalSubsNumber += mySubsNumber;
        }
        // Output Total ------------------
        //alert(totalSubsNumber);
        
        $("#totalSubsResults").fadeOut(500, function() {
            $(this).html("<table cellpadding=3 cellspacing=0 border=0 align=right>
<tr><td><span style=font-size:350%>"+totalSubsNumber+"</span></td><td><span style=font-size:125%>SUBS<br/>RESERVED</span></td></tr>
</table>
");
            $(this).fadeIn(500);
        });
        
    }

    function getDocsAllItemsFailure(sender, args) {
        alert('Failed to get list items. \nError: ' + args.get_message() + '\nStackTrace: ' + args.get_stackTrace());
    }
    
</script>

SQL Server - Recovering TempDB Space

-- STEP 01 ALTER FILE SPECS =====================================
USE master;
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdev, SIZE=100Mb);
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = templog, SIZE=100Mb);
GO


-- STEP 02 SHRINK FILES ========================================
USE tempdb
GO
DBCC shrinkfile (tempdev, 100)
GO
DBCC shrinkfile (templog, 100)
GO


http://www.sqldbadiaries.com/2010/11/13/tempdb-please-allow-me-to-shrink-you/
http://www.dbadiaries.com/how-to-shrink-tempdb
http://support.microsoft.com/kb/307487
http://technet.microsoft.com/en-us/library/ms175527(v=SQL.105).aspx 

6.27.2013

Free Stuff

Chrome Extension - Chrome Commander
Simple chrome extension that launches all of Google's search, office, services, software & resources. I got tired of trying to keep track of them all by memory. (shortcuts / bookmarks / favorites)

Python Script - pydev-googleapps-site
The intent of this project is to download Sites information via Google’s API. I put together this code because of two reasons:
  1. Google’s support of .Net is lacking. Python became the path of least resistance.
  2. There is an undocumented limit of 500 results per site feed request imposed by Google. They have a “max-results” option which one would believe actually returns all results, but it doesn’t.

5.31.2013

SQL Server Performance


For SQL Server Box:
1) Configure AV to ignore several key folders and files. Such own AV folder, SQL folders, SQL files, c:\pagefile.sys
2) Change power management option from balanced to performance.
3) Do not use SQL Boost.
4) Put SQL data files on separate drive.
5) Put SQL log files on separate drive, if possible.
6) Use simple database unless full logging is required.

4.16.2013

InfoPath - Line Breaks on Calculated Values

File this one under A for annoying. However, this work around does work for creating multiline, calculated textbox values without resorting to C# code.
http://blogs.msdn.com/b/infopath/archive/2005/03/04/385577.aspx

4.08.2013

InfoPath 2010 - DateDiff

InfoPath dates are stored in the format YYYY-MM-DD

To extract the day number of a date:
number(substring(field1, 9, 2))

To extract the month number of a date:
number(substring(field1, 6, 2))

To extract the year number of a date:
number(substring(field1, 1, 4))

4.02.2013

SharePoint 2010 - List Column Deletion

This little gem saves me quite a bit of hassle when developing a new content type.

$web = Get-SPWeb https://MYSITECOLLECTION
$list = $web.Lists["PDR"]
$field = $list.Fields["ConfAttendees"]
$field.AllowDeletion = “true”
$field.Sealed = “false”
$field.Delete()
$list.Update()
$web.Dispose()

3.25.2013

Antivirus Software

I am asked all the time for assistance with home antivirus. Here are some free options:
Avast  (I use this)
Microsoft Security Essentials  (I use this. Yes... I run two antivirus programs)
Avira
Malwarebytes
AVG
Panda - Cloud and Free Tools

If you feel the need to drop money on antivirus here are some options:
Kapersky
Panda
Norton (I don't recommend it and I won't even link to it)
F-Secure
G Data

Last but not least, practice good browsing habits and back your data up with some level of regularity.

3.07.2013

SharePoint 2010 - Access Assets Database

Great microsoft article explaining the configuration steps required to enable access database sites, such as the assets tracking site.
http://technet.microsoft.com/en-us/library/ee662542.aspx

3.05.2013

PSTools - Run As User

http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx
http://technet.microsoft.com/en-us/sysinternals/bb897553
psexec -u {DOMAIN}\{USER} -p {PASSWORD} "C:\Program Files\Microsoft Office\Office14\INFOPATH.EXE" /design

Sysinternals - Run As User

File this one under annoyances. To enable Right Click "Run as different user" option without having to hold the shift key, Download the SysInternals Suite from Microsoft.

Open up a command prompt, then run shellrunas /reg command from the Sysinternals folder.

Now all you should have to do is right click on the file, and you should have the run as different user option.

Another alternative is to use the following built-in command, but I found this doesn't work as well.
C:\Windows\System32\runas.exe /profile /user:{DOMAIN}\{USER} C:\Program Files\Microsoft Office\Office14\INFOPATH.EXE /design

Microsoft Office Shortcuts

Here is a list of Microsoft Office 2010 programs and their path to the executable in the file system:
Microsoft Office 2010 Tools\Microsoft Office 2010 Language PreferencesC:\Program Files\Microsoft Office\Office14\SETLANG.EXE
Microsoft Office 2010 Tools\Microsoft Office Picture ManagerC:\Program Files\Microsoft Office\Office14\OIS.EXE
Microsoft Access 2010C:\Program Files\Microsoft Office\Office14\MSACCESS.EXE
Microsoft Excel 2010C:\Program Files\Microsoft Office\Office14\EXCEL.EXE
Microsoft InfoPath Designer 2010C:\Program Files\Microsoft Office\Office14\INFOPATH.EXE /design
Microsoft InfoPath Filler 2010C:\Program Files\Microsoft Office\Office14\INFOPATH.EXE
Microsoft OneNote 2010C:\Program Files\Microsoft Office\Office14\ONENOTE.EXE
Microsoft Outlook 2010C:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE
Microsoft PowerPoint 2010C:\Program Files\Microsoft Office\Office14\POWERPNT.EXE
Microsoft Publisher 2010C:\Program Files\Microsoft Office\Office14\MSPUB.EXE
Microsoft SharePoint Workspace 2010C:\Program Files\Microsoft Office\Office14\GROOVE.EXE
Microsoft Word 2010C:\Program Files\Microsoft Office\Office14\WINWORD.EXE

2.28.2013

SSIS - Excel Querying

The power and flexibility of SSIS never ceases to amaze me. With just a few simple lines of code you can import and manipulate data straight out of excel.

This piece goes on to the actual excel connection provider.
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Temp\<FILENAME.xls>;Extended Properties="EXCEL 8.0;HDR=YES;IMEX=1";

Instead of table loading the excel file on the datasource, utlize a SQL query such as this.
SELECT F1,F18 from [Sheet1$A3:D8]
WHERE 
  F1 IS NOT NULL
  ........

2.27.2013

SharePoint 2010 - People Picker Configuration

There are so many nuances to this little tool in SharePoint. Configuration settings can only be done after installation using STSADM commands. Below are several resources I have found related to this topic.

Checking Accounts:
https://<SiteURL>/_layouts/people.aspx?MembershipGroupId=0
https://<SiteURL>/_catalogs/users/simple.aspx

People Picker Hide Inactive Accounts:
stsadm.exe -o setproperty -propertyname "HideInactiveProfiles" -propertyvalue "true"

Run These Command as SPFarm Account to Remove Old DBs:
stsadm -o sync -listolddatabases 1
stsadm -o sync –deleteolddatabases 1
stsadm -o sync –synctiming m:5 
(this is to alter the sync timing schedule in a DEV environment, default is 1 hour)

Awesome PowerShell Commands for Checking and Deleting Orphaned Users:
http://www.sharepointclowns.com/2011/04/find-and-delete-orphaned-users/

People Picker Resource Articles:
http://technet.microsoft.com/en-us/library/cc263196.aspx
http://technet.microsoft.com/en-us/library/gg602075(v=office.14).aspx
http://blog.helloitsliam.com/Lists/Posts/Post.aspx?ID=48

Resyncing an Account From AD:
Set-SPUser -Identity "<domain\username>" -web "<SiteURL>" -SyncFromAD

Manually Deleting Accounts:
1. In SQL: SELECT * FROM [WSS_Content_DatabaseName].[dbo].[UserInfo] WHERE tp_Login='DOMAIN\username'
2. Take note of the tp_ID
3. In IE, go to http://<your sharepoint site collection/_layouts/userdisp.aspx?ID=tp_ID, where tp_ID is the number you found from your select statement.
4. It should take you to the user's profile where you can click on the Delete User from Site Collection button.

2.20.2013

2.12.2013

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