Archive for the 'SharePoint General' Category

23
Jan
14

Creating a Link to Open a Word Document Content Type in SharePoint 2010

You might be familiar with creating a content type on a document library and associating a Word template with that content type.  When you do this, you end up with a very nice link in the Documents menu that fills in the blank, "I want to create a new ______."  In this case, I want to create a new ECCN Classification Document.

image

When Word opens up, it uses the template on the list content type so you can expose the content type columns as Quick Parts in Word.  If you’re not familiar with this process, it’s kind of a poor man’s form for SharePoint.

image

Once you’ve done this, you might want to create a link to use this on other pages and in other places…and least that’s what I wanted to do.

When you start looking around for a solution to this, you might find this post by Srini Sistla which is pretty much the route I originally went down.  It involves viewing the source on the page with the menu and attempting to replicate what the menu does.

image

This ends up with some JavaScript that runs CoreInvoke that then appears to wrap createNewDocumentWithRedirect.  Trying to read through all the encoded gibberish will make your head hurt, but you can do it and it will work. 

My goal was to make this as simple as possible and, assuming it was going to require some JavaScript to make it happen, I wanted it to be a lot more readable.  Also, I don’t want to include a lot of extra, hard-to-read and understand, code that doesn’t really add to the solution.  In this vein, I felt I should be able to execute createNewDocumentWithRedirect and not have to wrap it in anything else.  Perhaps I don’t understand fully what CoreInvoke is doing.  What I’ve found is it doesn’t appear to be doing much for the solution I need.

If you do a little research, you’ll find there is a pretty straightforward definition for the createNewDocumentWithRedirect function.  Perhaps the most difficult part of using any function is to know what to pass for each of the parameters.  Here’s where I’ll try and elaborate and make it easy for you.  Here’s the definition.

function createNewDocumentWithRedirect(strTemplate, strSaveLocation, strProgID, bXMLForm, strRedirectUrl, defaultItemOpen)

strTemplate – A string value that identifies the URL to the template file associated with the content type.

strSaveLocation – A string value that identifies the default save location you want Word to display when performing a save.

strProgID – A string value to the program ID (ProgID) SharePoint.OpenDocuments which identifies a registry entry that is associated with a CLSID.  Like the CLSID, the ProgID identifies a class but with less precision because it is not guaranteed to be globally unique.

bXMLForm – A boolean (true/false) indicating whether this is an XML form.  False for Word and other office documents.

strRedirectUrl – A string value that contains the URL to redirect to after closing Word.  NOTE:  I’m not positive this works when closing Word.  I haven’t been able to get it to work.  Does it require CoreInvoke?  I tried that and it didn’t work either.

defaultItemOpen – Specifies whether to open items in a client application or in the browser.  Not really sure if it has much affect on opening Word documents in this context, but a 0 means open in the thick client and 1 means open in the thin (web) client.

Here’s what the ProgID looks like in the registry.  You’ll see that SharePoint.OpenDocuments points to SharePoint.OpenDocuments5 which, in turn, points to the CLSID (unique identifier for the class).  Kinda’ like "there’s a hole in the bottom of the sea."

image

image

image

So, if we continue on and create an anchor <a> link with some JavaScript on the onclick event, it looks something like this, which is much easier to read.

NOTE:  If you copy and paste this be aware that the single quotes can get changed to the accent grave variety (not the ambidextrous single quote we are used to, the ')

<a onclick="createNewDocumentWithRedirect(‘https://yoursite.com/sites/WPL/CCL/Saved Records/Forms/ECCN Classification Document/ECCN Classification.docx’, ‘https://yoursite.com/sites/wpl/ccl/saved records’, ‘SharePoint.OpenDocuments’, false, ‘https://yoursite.com/sites/wpl/ccl&#8217;, 1);" href="#">createNewDocumentWithRedirect Test</a>

When you put this in a content editor web part in SharePoint 2010, it will encode the apostrophes and change them to '.

However, you’ll note that I didn’t have to encode the spaces in my links, and they work just fine.

So, what are these links anyway?  The first one, strTemplate, is the link to the template that was uploaded.  This is the link to the template on the list.  You can see this in SPD or look at the list content type page and copy it from the Edit Template link.

https://yoursite.com/sites/WPL/CCL/Saved Records/Forms/ECCN Classification Document/ECCN Classification.docx’

image

 

image

When you implement this in a content editor web part it looks something like this.  In this case I have two test links.  The "Word 2010" link uses the CoreInvoke function and the "createNewDocumentWithRedirect Test" link uses the createNewDocumentWithRedirect function.  Both seem to give me the same results, but the 2nd one is much easier to read and duplicate.

image

 

image

Advertisements
21
Nov
12

Site Navigation Settings Missing in SharePoint 2007 Using IE9

So let’s say you are using IE9 and you go to the Site Navigation Settings page on a 2007 SharePoint site and see this:

image

And you scratch you head and wonder, “Where are all my navigation settings?”  Perhaps you did this many moons ago and you think it’s just old age setting in.  But a little Googling indicates you aren’t going crazy (or senile) and there’s some JavaScript issue with the page.

Try this.  Start IE9 without any add-ons by executing

iexplore –extoff

Then, navigate to the same page and voilà, your navigation editing area appears!

image

This must be due to some malcontent add-on.

Enabling and disabling add-ons and refreshing your page brings you to NameCtrl Class being the add-on that seems to be causing the problem.  Disabling this add-on fixes the issue…at least it did for me!

image

 

Search terms:

NameCtrl Class Microsoft Corporation

Add-on issues with IE9 and SharePoint 2007 navigation

10
Oct
12

Microsoft Project 2010 Sync with SharePoint 2010–Sorting It Out!

The sync with Project 2010 is great, but there are some "issues" you might run in to.  One of these is sorting the SharePoint task list so it matches up with Project.  I’ve found the key to this is to add the WBS (Work Breakdown Structure) column to the sync columns and sort by the WBS column.  For those not familiar with WBS, it is a hierarchical numbering scheme used for tasks in a project plan, similar to legal numbering of paragraphs, i.e. 1, 1.1, 1.1.1, 1.1.2, 2, 2.1, 2.2, 2.2.1, 2.2.2, etc.  Using the WBS as a sort field allows you to keep the tasks in the project plan order.

Add a simple text column called WBS to your SharePoint task list.

image

Using the Sync feature on Project Professional 2010, add the WBS column to the list of sync’d fields.

image

image

Sync your project to SharePoint (that can have its own set of issues).

Add the column as a primary sort column to your view.

image

Voilà!  You are sorted by WBS!

image

As you drill through the tasks, you’ll notice they are all in WBS order.

image

If you create a view that excludes folders, you’ll see something like this.  The important thing to note is, since this view is excluding folders, the summary tasks are not shown, as they are implemented as folders in SharePoint.

image

02
Oct
12

Launch form in a dialog doesn’t work correctly when displaying a list in datasheet view

This was driving me nuts.  I had a custom list in SharePoint 2010 and I wanted the new item form to NOT open in a dialog.  No matter what I did, it kept opening in a dialog.

image

Then I stumbled upon what was causing my issue!  Whenever the list was displayed in a datasheet view (which was my default), the new item form would always display in a modal dialog.

List displayed in datasheet view.

image

 

 

 

 

 

 

 

 

 

 

Create a new entry…

 

image

 

…and modal dialog is displayed (notice no master page "chrome”).

 

image

 

Change to standard view…

 

image

 

…and the form is opened up in single page mode (notice master page “chrome”).

 

image

What’s up with that?

An interesting thing to note is this problem also exists with Calendar lists.  If you display a calendar list in anything other than a normal list view, the “Launch forms in a dialog” will not be respected when set to “No.” 

Again, if we set “Launch forms in a dialog” to “no” and view the calendar in “Calendar” view…

 

image

 

…and attempt to create a new event while in this view…

 

image

 

…the form opens in a dialog.

 

image

 

If we change to the “All Events” view and attempt the same thing…

 

image

 

The form is opened in a new page (no dialog).

 

image

 

Perhaps this is the designed behavior, but if it is, I would recommend renaming the option to “Launch forms in a dialog when showing items in standard view.”

The description of the option would lead one to believe there might be times when a dialog would not be displayed when you would expect it to be displayed…not the other way around.

 

image

 

I guess I shouldn’t be disappointed when I get “free” dialog forms.

 

Keywords:

Launch form in a dialog broken

Launch form in a dialog doesn’t work for custom list

List view affects dialog form

16
Mar
12

Add a Link to a Document to get around file size Limitation

Many times SharePoint users run into the maximum file size allowed on their SharePoint farm and the SharePoint administrator won’t change the rules and allow larger files.

One way to get around this is to enable the "Link to a Document" content type on and store the file on an available file share.  Here’s how you do it in 2007.  It’s similar in 2010.

Go to Document Library Settings.

image

Click on Advanced.

image

Enable management of content types.

image

Click on Add from existing site content types.

image

Add "Link to a Document" and click OK.

image

"Link to a Document" should now show up in the list of content types for your library.

image

Navigate back to your document library and click on the New drop-down and select "Link to a Document." 

image

If you attempt to enter a file:// URL to the file on your server, you’ll probably get an error, so put in a dummy URL that begins with http://.&#160; Here’s an example URL.  http://wplnet/public/Aims/TRAX/BigFile.csv.

image

Edit the properties of the link.

image

Change the http:// prefix to file://

image

Click on the link and you should be directed to the file on the server.

image

A similar process can be used for SharePoint 2010.

20
Sep
11

Date and Time Formats in a Workflow

This is just so I can remember what the date and time formats look like when you reference the current date in a workflow variable.

Here’s a short workflow

image

and here are the results.

image

07
Jun
11

How to use nested quotes on the Runas command

This isn’t exactly SharePoint related, but it does deal with SQL Server (that is used by SharePoint) so I’m going to post it here anyways.  So shoot me.

To run SQL Server Enterprise Manager (Ouch!  What is he doing with SQL 2000?) as another user from the command line you can either use short file names or nested quotes.

C:\Windows\System32\runas.exe /user:domain\username "C:\Windows\System32\mmc.exe /s C:\Progra~2\Mi3EDC~1\80\Tools\BINN\SQLSer~1.msc"

If you want to use short filenames, you can cd to each directory and perform a dir /x to display the short directory or filename.

image

Or, if you want to use long filenames:

C:\Windows\System32\runas.exe /user:domain\username "C:\Windows\System32\mmc.exe /s \"C:\Program Files (x86)\Microsoft SQL Server\80\Tools\BINN\SQL Server Enterprise Manager.MSC"\"

The trick to using long filenames is to use \" for the first nested quote and "\ for the matching nested quote.

In either case, when you run the shortcut you’ll be prompted to enter your password.

image




Asif Rehmani’s SharePoint Videos

SharePoint-Videos

Click to access a wealth of SharePoint videos

SharePoint Rx

SharePoint Rx Home

Categories

Posts by Date

August 2019
M T W T F S S
« Jun    
 1234
567891011
12131415161718
19202122232425
262728293031  
Support Wikipedia
Advertisements