Showing posts with label SharePoint 2013. Show all posts
Showing posts with label SharePoint 2013. Show all posts

Wednesday, November 12, 2014

Set Default Content Type

I am writing this because I couldn't find the way to set the default content type through the browser. If you know, please comment below.

The reason for doing this is to have your content type come up when the user selects new item. If you didn't do this, the user has to click the down arrow on the new item in the ribbon, and then select your content type. (Sometimes, this is just too much to ask a user to know how to do and why "Promoted Links" is so popular.)



It is actually quit ease with SharePoint Designer. You only need to navigate to your list, select the content type, then select 'Set as Default' from the ribbon.


Cheers!

Carlos

Wednesday, October 22, 2014

Clearing Your OneDrive Cache

For those of you that use OneDrive extensively, you may find that your disk drive is quickly running out of space. This is because OneDrive caches files on your Office temporary folder. These can get very large because it creates a cache file that is just a copy of the file it is trying to sync. I'm not sure what will trigger the cache files to clear out, so I created this batch script to clean out the files when I want. Just save this to a .bat file and run it.

Note: the %temp% directory, at this time, is something like "c:\users\xxxUSERxxx\AppData\Local\Microsoft\Office\15.0\OfficeFileCache"


cd %temp%
cd ..
cd microsoft
cd office
cd 15.0
cd OfficeFileCache
dir
forfiles /m *.fsd  /d -1 /c "cmd /c del @file : date >= 1 days >NUL"
forfiles /m *.fsf  /d -1 /c "cmd /c del @file : date >= 1 days >NUL"

pause

This script tries to avoid any currently opened files by starting with yesterdays  files (and older.) Technically you could just delete everything with *.* and windows will just ignore all the files that are open because OneDrive is trying to sync them at the moment and has them locked. What I'm trying to avoid with my approach is to avoid deleting the  "CentralTable.xxx" files that OneDrive is using to manage the file syncing.

On a related note, When you run a repair on OneDrive it creates  *.Oldx versions of your OfficeFileCache folder in the %temp%\microsoft\office\15.0 directory with folder names like OfficeFileCache.old1, OfficeFileCache.Old2. These are copies of the folders before the repair executes. These can be deleted - if you are comfortable with the files you have on your OneDrive locally and in the cloud.

Cheers,

Carlos

Thursday, August 7, 2014

No Code Hide Recent from Quick Menu

This isn't new, other's have posted this solution, but I think it's so elegant that I just want to spread the word. There are many JavaScript solutions, but personally, I would rather have a no code solution. It's simple so I'm not going to post any images. There are others that have created step-by-step blogs that are much more detailed, so keep looking down the google search results list if you need more info. :)

1. Create a new SharePoint group called Nobody.

2. Remove yourself from the group. (you are automatically added when you create the group.)

3. Under Site Settings, Navigation, under  "Structural Navigation: Editing and Sorting", select 'Recent' and click edit.

4. In the Audience field, add "Nobody".

5. Make sure to kick 'OK' for the page or your changes won't be saved.

Voila!


Cheers,
Carlos

Wednesday, August 6, 2014

SharePoint 2013 Enterprise Search Go Back - Revisited

This is a rehash of my previous post on the same subject, but it's been redone to use images.

So you want to leverage SharePoint Enterprise Search because it has all the bells and whistles you are looking for in your results and search features. You set your site to leverage enterprise search and you let people start using it. The problem that comes up is that when a user begins using the search, they are taken to the Enterprise Search site collection and there is no quick way to get back from where they started. The only way, out the box, is to hit the back button until they are back to where they started.

I found this to be less than ideal, so I cobbled together some JavaScript that leverages a browser session cookie to capture the site they launch the search. When the user is ready to go back, they simply click on the back button to return to where they started.



Here is the javascript:

<script type="text/javascript">
_spBodyOnLoadFunctionNames.push("returnGoBackURL");
function returnGoBackURL() {
//*******************Specify your url search site here (with https and ending forward slash)*********
var rootURL = 'https://xxxxx.sharepoint.com/sites/searchFAST/';
var lastURL = document.referrer;
if (lastURL.substr(0,rootURL.length) != rootURL) {
setCookie('lastURL', document.referrer, 1 );
document.getElementById('returnURL').href = document.referrer;
} else {
document.getElementById('returnURL').href = getCookie('lastURL');
}
}

function setCookie(c_name,value,exdays){
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value + ";path=/";
}
function getCookie(c_name) {
var i,x,y,ARRcookies=document.cookie.split(";");
for (i=0;i<ARRcookies.length;i++)
{
 x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));
 y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);
 x=x.replace(/^\s+|\s+$/g,"");
 if (x==c_name)
   {
return unescape(y);
   }
}
}
</script>
<a href="https://xxxxx.sharepoint.com"><img border="0" src="/sites/searchFAST/SiteCollectionImages/home2.png" alt="home"></a>
<a id='returnURL' class='returnURL' href='http://xxxxx.sharepoint.com'><img border="0" src="/sites/searchFAST/SiteCollectionImages/back.gif" alt="back"></a>


Here are the a couple of starter images for Home and Back. Just update the image references in the script to point to the location of these files after you have put them on your site.


Add the script to a file and put it in the site collection documents. You will need to add a content editor web part (CEWP) to each of the search result pages and point it to the file you saved with the above script.  I put the CEWP under Search Navigation.



In O365, the search site has a document library called 'Pages'. In here are a number of result pages used to display the search results. The default is 'results', but you will find others for 'peopleresults', 'videoresults' and some others. You will want add the content editor webpart to all the result pages where you want the back button to appear.

Cheers,
Carlos