Buttons, Buttons, Buttons.How to create a Sp 2013 Javascript button to create a new doc

6 04 2016

You know what’s not so easy in Sp2013? Newform.aspx urls. Sure they live in the document library ribbon.
Sure you can also just drag stuff in, but what if you want to create a custom page and make it even easier for your users to create a new document?
That’s not so easy. So i set about figuring out the best way to do this.
Javascript buttons look cool and professional, so I thought, hey why not.
So I scoured the interwebs for some code. I came across this Gem by Ahmed Farag:
https://blogs.msdn.microsoft.com/how24/2014/09/23/create-a-link-to-display-edit-and-create-new-items-from-a-dialog-layover-in-sharepoint/
Thanks Ahmed you got me started!
This is an elegant solution if your library is out of the box. But what if you have custom content types?
That is not so easy to figure out. Once i did figure it out it was easy but not at first. You see, if you add a custom content type to a document library, the content type lives in _layouts, not in list/library name.
So how do you link that?
Well my friends, I am glad you asked.
First things first, like Ahmed says, grab yourself a content editor webpart (not script editor, that one has issues) and add it to a page.

Open your fav notepad editor
Copy Mr. Farag’s elegant code into it and click save.

 

(script type="text/javascript")
 function displayLayover(url) { 
 var options = SP.UI.$create_DialogOptions(); 
 options.url = url; 
 options.dialogReturnValueCallback = Function.createDelegate( 
 null, null); 
 SP.UI.ModalDialog.showModalDialog(options); 
 } 
 (/script)
Upload to your site asset library and link it via web part editor propeties
Now you have a pretty nifty button, but it doesn't do anything.
According to Ahmed, you should add the HREF key after your code for newitem.aspx.
However, as I alluded to early, that's not going to fly if you have a custom content type.
So here is his code:
<a href='javascript:displayLayover("/Lists/Contacts/NewForm.aspx?IsDlg=1")'>Display Item </a>
As you will figure out, content types do not live in /list/, they live in _layouts. So, how do i get that darn URL?

Its actually stupid simple. 
Basically, all you have to do navigate to your library settings, advanced settings, and find the open forms in dialogue, and click no.
Go back to your library and click new document and select your custom content type.

That will open your new item in a page, where, gasp, you can copy the url and past it into Ahmed code.

<a href='javascript:displayLayover("http://mysharepoint.domain.com/_layouts/15/NewDocSet.aspx?List=bc691a02%2D6335%2D4aee%2Da0e8%2D70185ab0491e&Source=http%3A%2F%2site%2Edomain%2Edomain%2Ecom%2F15%2Fnewlibrary%2FForms%2FAllItems%2Easpx&ContentTypeId=0x0120D520006B5814CAEDD0FD4C8F8F5C6B8AD7978C00F45CB6B8B2D5A74C8046CA70881BB0F7&RootFolder=%2F15%2Fputthisinyournewlibrary")'>New Content Type </a>

That's it. Now you have a new button that creates your new content type.

Tips: Make sure when you use content editor you upload your code to the asset library and link the file inside the content editor, so you can edit it easier.

TIP: Turn on versioning in your asset library so you can version your code out.

 

You are welcome world!

Nando





SharePassion Creed

16 12 2015

The argument goes as follows,” I can’t find anything in this mess of a file share.” The answer I give is, “SharePoint can help with that!”. The reaction to that is, “SharePoint is too complex!” or “I have too much stuff to sort through!”, or something to that extent.

Bro, do you even SharePoint?

Why do I even bother? I’ll tell you why. Because I love what I do. I love SharePoint and what it can do. I enjoy watching the light bulb in people’s heads go off when they see what this amazing piece of technology can do for them. Yes, I am a geek and damn proud of it.

No joke, I have not gone to work since 2005, when I first started working with SharePoint. Why am I telling you this? Because, I want you to know what SharePoint means to me and the many other passionate folks in the SharePoint community. These people, put in ungodly amounts of their free time, to speak and help anyone understand what it is to SharePoint. Some go under the radar and others like Todd Klindt and Christian Buckley go above and beyond to help us all out. Honestly, I am proud to know them and even call them friends. So guys, from the bottom of my ShareHeart, ShareThankYou for what you ShareDo.

Shameless plug for you buddy: You wanna know SharePoint….

https://t.co/fKNpd7jWyA

Which brings me to the reason I was suddenly motivated to write this. Passion. It is funny that a stupid (well actually pretty good) movie about a Chef that opens a food cart in Miami, choked me up enough to tickle the keyboard.
So, passion, it is why I do what I do. Anything worth doing should be done with passion. SharePoint is one of those things. It allows the technical and analytical boring side of me to merge with my goofy creative side. I love that! It makes me excited to go to work every day.

It made me spend hours on google trying to find out why the UPS service gets stuck on provisioning.

It made me figure out how to do an accordion mega menu for universal navigation.

It even made me spend a week trying to figure out how to write a workflow that creates sub-sites on demand by using JSON calls. I feel like a dev.

SharePoint is that amazing. Three completely different problems, in the same framework. It is both a science and an art and if that doesn’t get you going in the morning, then you must live in Lotus Notes land or something.

On-prem or in the cloud, it doesn’t matter to me. There is a solution that needs to be crafted for someone, somewhere and I intend to make it.

Us SharePoint people, we are grinders. We grind every day and I dig that about you all.
Thank you very much for being there for us all and if I can be of any service, you can count on me.

Here’s to more SharePassion in 2016 and beyond!

I bequeath to you all the SharePassion Creed.

This is SharePoint. There are many like it, but this one is mine.

SharePoint is my best friend. It is my life. I must master it as I must master my life.

SharePoint, without me, is useless. Without SharePoint, I am useless. I must configure SharePoint true. I must not use the configuration wizard. I must use powershell, I will…

SharePoint and I know that what counts in the farm is metadata, not the folders they want, nor sub sites they say they need. We know that it is search that count. We will search…

SharePoint is human, even as I, because it is my life. Thus, I will learn it as a brother. I will learn its weaknesses, its strength, its web parts, its accessories, its workflow engine and its API. I will keep SharePoint clean and ready, even as I am clean and ready. We will become part of each other. We will…

Before God, I swear this creed. SharePoint and I are the defenders of the information. We are the masters of our data. We are the saviors of documents.

So be it, until there are no more folders and there isn’t 1 content database that holds 5000 sites, but clean flat metadata.

Thank you Microsoft for keeping it On Prem!

Nando






SharePoint 2016 is out!

24 08 2015

So excited to announce that the Tech Preview for SharePoint 2016 is out today. Read all about it, here
https://blogs.office.com/2015/04/16/sharepoint-server-2016-update/
This link includes the link to the download as well. Scroll down to the bottom.
So much cool geek stuff in this tech preview to talk about. I will be updating the Dojo when i get my VM running at home.
Also, there is an AZURE SharePoint 2016 offering coming this week. Stay tuned for details.
I am off to install it. Will post later.

Nando





SharePoint Logos: One logo to rule them all.

13 05 2015

I have been racking my brain trying to figure out a way to force all sites in my SharePoint farm to use the same logo. Obviously I should have stapled it to my master page before pushign it out, but as usual I suck.
So i decided to break out the old PowerShell machina and take a crack at it.
I found a bunch of sites that showed how to do this for all SUBSITES in a Site Collection, but not all Site Collections and subsites.
Here is what I came up. Hope it works for you guys.
This code is as is and I don’t take any responsibility for screwing up your farm.

$sitelogo=”SPSITE where your logo resides usually _layouts/site assets/”

$Site=”http://rootsite

$Sites=Get-SPWebApplication $Site|Get-SPSite -Limit All |Get-SPWeb -Limit All|Select URL

$Sites|ForEach-Object {

$CurrentSite=$_.URL

$CurrentSiteObject=new-object Microsoft.SharePoint.SPSite($CurrentSite)

foreach($web in $CurrentSiteObject.Allwebs) {

$web.SiteLogoUrl=$sitelogo

$web.Update()}

$CurrentSiteObject.Dispose()}

Happy SharePointing!

KTHANKSBYE
Nando





SharePoint 2016 is here, or is it?

4 05 2015

Walking the floor getting to the SharePoint 2016 roadmap, you will be hard pressed to find any SharePoint demos. The cloud is omni present and any traces of on premis SharePoint is cleverly resigned to the fine print.
“Come to our booth and learn about this cool O365 plugin!”, was a line a heard quite a bit. Naturally I asked about on prem and ubiquitous answer was, “oh yeah we do that too.”

But now, Mr.Baer is about to make all our dreams come true with 2016. The anticipation is palpable.
Wifi suddenly went down but now its back up.

  
I guess Bose is here and they went to the cloud

  
Ernest and young has on prem sp and decided to stay on prem yay!

So what did I learn about SharePoint 2016? Well its going to be awesome.
No down time patching, which makes me very happy.
DOCID type technology that follows the document all over the farm.The link never changes!
Built on SharePoint 2013 base technology.
The ability to connect to office graphy online!

I am super excited about it all. More to come.

Nando.





Keynote notes

4 05 2015

Satya says mobile first cloud first. Not sure how I feel about that yet. He did say devices don’t matter. Only experiences. 

Create more personal computing. Investing heavily in personal data. Building trust into the kernel? Can I build that into my mortgage? 

Super stoked for holographic computing. 

Most profound change is windows 10. WAS. Windows as a service. 

New capabilities for windows update. Not sure what he meant by that. Please god make it not break SharePoint. 

Satya said skizm. I heard it. 

Satya says compliance is built into all collaboration platforms. So that end users choose what they want and have it pros be able to lock it down. 

Driving application agility. Devops in visual studio. 
  
Real Madrid was introduced as a transformative example with social awareness and player analytics.  


Windows 10 is the center of the keynote.   
  

Windows 10 looks cool and is aimed at windows 7 users for upgrade. 

Task view will show old win 32 and new 10 apps. Familiarity is key

  
A lot of cortana love. Siri is not jealous. Cortana with local index for searching files is awesome. 

Cortana connected to powerbi!!!

  
  

New Delve helps you work better by showing you what you are spending the most time in.  

  

 








Follow

Get every new post delivered to your Inbox.

Join 159 other followers