Don’t waste time. Go!

(Pictures are in German, if you want them in english as well, let us know)!

Requirement:

Each team / teamsite (http://sp13/teams/it) should have the option to create a news element.
This element has the option where it should be shown. The user has to select this via a dropdown with the values:

  • Workspace (sp13/teams/information-technology-workspace)
  • Teamübergreifend (sp13/teams/information-technology-workspace) + (sp13/teams)
  • Shout (sp13/teams/information-technology-workspace) + (sp13/teams) + (sp13/)

Also each element has to have it’s own pictureURL + pictureURLFavicon field value depending on the department. This should be filled out automatically.
Futhermore I need the shout items in one list so I can get them with REST and modify the view afterwards.

Problem:

If I want to work with SharePoint Designer 2013 Workflows it is quite hard to do all those workflows for all teamsites.
Also it is difficult to get the element updated if I copy the element in all there lists.

My Solution:

I have just ONE list which is called news and created at sp13/ with all the columns I need.

News solution over multiple sites(en)_12

Next I go to the workspace site (teamsite) sp13/teams/information-technology-workspace and add a content editor to the page. Edit the source and added the following script:

News solution over multiple sites(en)_11

Script:

<script type="text/javascript">
	    var options;
	    function openModalDialog(url) {
	        options = SP.UI.$create_DialogOptions();
	        options.width = 600;
	        options.height = 650;
	        options.title='News posten';
	        options.url = url+"?IsDlg=1";
	        options.dialogReturnValueCallback = Function.createDelegate(null, CloseCallback);
	        //SP.UI.ModalDialog.showModalDialog(options);
	SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
	    }
	    function CloseCallback(result, target) {
	        location.reload(true);
	        //window.location.href = document.URL;
	    }
	
</script>

<a onclick="openModalDialog('https://sp13/lists/news/NewForm.aspx');" href="#"><img src="/PublishingImages/icons/plus32_32.png" alt="" style="margin: 5px;"/></a>

With this, I am able to create from the workspace site (the teamsite) a news item in the news list based at sp13/ in a modal dialog!

News solution over multiple sites(en)_1

If we check now the news list we can see, that there is the element and also the workflow fired.
(Simple workflow, just checks the team field and depending on that sets the PicutreURL, PictureURLFavicon and if the link is empty set’s that to the teamsite)

News solution over multiple sites(en)_2

Also I am showing the news item based on the searchresults webpart on my teamsite (filterd by team, crawled property “team” -> managed property “RefinableString00”)

News solution over multiple sites(en)_3

Now if we create a second item and want to publish it to the “Teamübergreifend” we select that in the form.

News solution over multiple sites(en)_4

and it is also added to the news list. You see that the empty link was filled out by the workflow.

News solution over multiple sites(en)_5

We created a second view where we only show the items, if the column “Veröffentlichen” (publish) is “Teamübergreifend” and exported the news list so we can import it in the sp13/teams site. How to export and import an webpart? Check out my other blog post.

News solution over multiple sites(en)_6

Finally the last requirement is to create a news item which has to be shown also on the startpage. So we create a new one and select “shout”.

News solution over multiple sites(en)_7

It also goes into the news list.

News solution over multiple sites(en)_8

Now we use this blog post (Facebook-Like-Button-Style), to display the items which are “shout” items in this kind of view:

At the start page:

News solution over multiple sites(en)_9

And if you click onto the icon or on a other shout news you will be redirected to the shout news overview page which looks like that:

News solution over multiple sites(en)_10

That’s it. One list, three places, not that much to do! I like it.

If you do too, comment it, like it, share it and don’t be afraIT to write me if you have questions.

LEAVE A REPLY

Please enter your comment!
Please enter your name here