Monthly Archives: July 2014

Nintex Workflow – Custom Inline Function

Hi everyone. Today I want to show you how you can develop custom inline functions for the Nintex Workflow product for SharePoint.

I got the idea from here (Absolutely great post.) but I created a SharePoint solution file because I thought this would be a bit simpler to use.

First open Microsoft Visual Studio and create a new Empty SharePoint Project. Remember to deploy it as a farm solution.

nintex_custom_inline_new_sharepoint_project

Now add a new Class. I called mine “Function.cs”.

nintex_custom_inline_code

Here is some example code I added to my class. (I got the code also from here.)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CustomNintexInline
{
class Function
{
public static int Random()
{
Random rnd = new Random(Environment.TickCount);
return rnd.Next();
}

public static int Random(int _iMax)
{
Random rnd = new Random(Environment.TickCount);
return rnd.Next(_iMax);
}

public static int Random(int _iMin, int _iMax)
{
Random rnd = new Random(Environment.TickCount);
return rnd.Next(_iMin, _iMax);
}
}
}

Now build your project.

After you successfully built your project run cmd as Administrator and go to the following path:

C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

Next run the following code to retrieve the Public key token:

sn.exe -T "Path-To-Your-dll/Project.dll"

Write down the value of your Public key token you will need it later.

nintex_cutom_inline_sn

Next you need to add your solution file to your SharePoint Farm. Do this by running PowerShell as Administrator and by running the following commands:

Add-PSSnapin Microsoft.SharePoint.PowerShell
Add-SPSolution "Full-Path-To-Your-WSP/Project.wsp"

nintex_custom_inline_add_solution

Next open your SharePoint Central Administration and deploy your solution globally.

nintex_custom_inline_solution

Next go to:

C:\Program Files\Nintex\Nintex Workflow 2010

Now run cmd as Administrator and run the following code to add your custom inline function to your Nintex Workflow product:

NWAdmin.exe -o addinlinefunction -functionalias "fn-Random (The string alias used to use your function later in your workflows)" -assembly "CustomNintexInline, Version=1.0.0.0,  Culture=neutral, PublicKeyToken=<Value you retrieved before by using sn.exe> (dll data)" -namespace "CustomNintexInline (Namespace of your Project)" -typename "Function (Class of your Project containing your function)" -method "Random (Method/Function name in your Project)" -description "<A short description what your function does>" -usage "<How to use your function>"

If the above command finishes without error messages your custom inline function has been successfully added to your Nintex Workflow product.

nintex_custom_inline_nwadmin

Next run cmd as Administrator and run the following command to restart IIS:

iisreset

That´s it. Now your custom inline function should be available. To test it I created a simple Nintex Workflow:

nintex_custom_inline_test_workflow

When you go to Inline Functions in one of your Nintex Workflow Actions you will find your custom inline function. (Called “Random” in my example)

nintex_custom_inline_use

Here you can see the result of my Test workflow:

nintex_custom_inline_test_mail

As you can see everything worked as expected and your custom inline function is ready to use. I hope you liked my today´s post. See you next time.

As always you can download my code from here.

Sources:

http://www.vadimtabakman.com/nintex-workflow-developing-a-custom-inline-function.aspx

Advertisements
Tagged ,

Raspberry Pi FM Transmitter

Hi everyone. Today I´m going to show you how you can make a FM transmitter out of your Raspberry Pi.

Prerequisites:

  • Raspberry Pi
  • Operating System installed (I used wheezy)
  • SSH server up and running (To connect to your Raspberry Pi)
  • About 20cm of wire

Recommended tools:

The first thing you need to do is to run the update command to avoid running into issues:

sudo apt-get update

Next download the file Pifm.tar.gz:

wget www.icrobotics.co.uk/wiki/images/c/c3/Pifm.tar.gz

Alternately you can download the Pifm.tar.gz file from here.

Next unzip the downloaded file:

tar -xvf Pifm.tar.gz

Now add about 20cm of wire to the GPIO 4 pin as antenna.

raspberry_pi_gpio

That´s it. Your FM transmitter is ready to go.

To test it run the following command (Please replace 100.1 (MHz) with a free frequency you can use legaly in your country):

sudo ./pifm sound.wav 100.1

You should now hear the sound playing.

Play MP3 files

To play mp3 files you need to do a bit more. First you need to install sox:

sudo apt-get install sox libsox-fmt-all

Now run the following command to play your mp3 file (Please replace 102.3 (MHz) with a free frequency you can use legaly in your country):

sox -t mp3 SomeSong.mp3 -t wav -r 22050 -c 1 - | sudo ./pifm - 102.3

I also created a short script file to make it easier to run mp3 files:

sox -t mp3 $1 -t wav -r 22050 -c 1 - | sudo ./pifm - $2

Now you can simply run the following command to play mp3 files:

./fmplay.sh SomeSong.mp3 102.3

That´s it. You can now use your Raspberry Pi as a FM transmitter to create your own radio sender and to impress your friends. I hope you liked my today´s fun post. See you next time.

Warning: Do not interfere with frequencies used by ambulance, police, radio senders, etc. It is illegal and you might get into big trouble so please be careful and make sure to use only frequencies which are free to use in your country.

Sources:

http://www.instructables.com/id/Raspberry-Pi-Radio-Transmitter/step3/Using-the-Software/

http://www.maketecheasier.com/run-radio-station-with-raspberry-pi/

http://linux.about.com/od/Bash_Scripting_Solutions/a/How-To-Write-Bash-For-Loops.htm

http://stackoverflow.com/questions/18003370/script-parameters-in-bash

Tagged

Restrict old Internet Explorer Versions

Hello everyone. Today I´m going to show you how to use AppLocker to block old versions of Internet Explorer from Execution. The requirement I had to fulfill was to make sure that Internet Explorer versions below 9 will not be able to run. Here is how you can do this:

Open up your Group Policy Management Editor.

restrict_old_ie_versions_gpo_start

Now go to Computer Configuration -> Policies -> Windows Settings -> Security Settings -> System Services and look for the service Application Identity. This service is needed to identify your application. When this service is not running your Allow and Deny rules will not apply.

restrict_old_ie_versions_application_identity_service

Select Automatic to start this service automatically when the system is started.

restrict_old_ie_versions_application_identity_service_properties

Next go to Computer Configuration -> Policies -> Windows Settings -> Security Settings -> Application Control Policies -> AppLocker -> Executable Rules.

restrict_old_ie_versions_gpo_application_control_policies

Now click on Create New Rule…

restrict_old_ie_versions_application_new_rule

This will open up a wizard. The first thing you need to do is to choose Deny and leave Everyone filled in in the text box (Because we want to deny everyone the right to start old Internet Explorer versions).

restrict_old_ie_versions_application_new_rule_deny

Next choose Publisher.

restrict_old_ie_versions_application_new_rule_publisher

Now click on Browse… and go to C:\Program Files\Internet Explorer and choose iexplore.exe. (By the way: You can also go to C:\Program Files (x86)\Internet Explorer and choose iexplore.exe. It does not matter. The rule we are defining will block the 32bit version as well as the 64bit version from Execution.)

Next check Use custom values and go to File version: enter 9.0.0.0 into the text box and choose And below.

restrict_old_ie_versions_application_new_rule_version_below

On the next page you have the choice to add Exceptions if you want to add some. But we will simply add none and click on Next.

restrict_old_ie_versions_application_exceptions

Now you can enter a Name and a Description for your Rule.

restrict_old_ie_versions_application_name_and_description

Now your Rule is finished. If you are asked if you want to create the Default rules click on Yes.

restrict_old_ie_versions_application_exexecutable_rules

If a user with a Internet Explorer version below 9 wants to start it he/she will receive the following error message:

restrict_old_ie_versions_application_error_message

A user with a higher Internet Explorer version will see no difference at all as you can see:

restrict_old_ie_versions_application_ie10_working

 

Well that´s it. Pretty simple, right? This way you can prevent security issues caused by old Internet Explorer versions. I hope my post was useful for you. See you next time.

Sources:

http://www.windowsecurity.com/articles-tutorials/authentication_and_encryption/Securing-Application-Execution-Microsoft-AppLocker.html

http://www.kodyaz.com/articles/windows-7-applocker-tool-step-by-step.aspx

http://www.grouppolicy.biz/2010/04/how-to-configure-applocker-group-policy-in-windows-7-to-block-third-party-browsers/

http://esihere.wordpress.com/2011/06/18/step-by-step-guide-on-configuring-applocker-in-the-domain/

http://4sysops.com/archives/applocker-tutorial-part-4-deployment/

Tagged ,

SharePoint – Configure 24 hour format on all sites

Hello everyone. Today I got the request to change the default time format used on all SharePoint sites to the 24 hour format and I thought I should share how to do this.

Here is the script:

#Add SharePoint PowerShell SnapIn if not already added

if((Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin Microsoft.SharePoint.PowerShell
}

$AllSPSites = Get-SPSite -Limit All

foreach($SPSite in $AllSPSites)
{
foreach($SPWeb in $SPSite.AllWebs)
{
$SPWeb.RegionalSettings.Time24=$True
$SPWeb.Update()
$SPWeb.Dispose()
}
}

All you have to do is to run this script on one of your SharePoint Farm servers as SharePoint Administrator and your work is done. That´s it.

As always you can download my script from here.

Sources:

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsite.allwebs.aspx

http://social.technet.microsoft.com/Forums/sharepoint/en-US/397a8fed-d589-4174-8d2a-9350262a142e/change-locale-and-timecalendar-format-for-400-site-collections?forum=sharepointadminprevious

http://sharepoint.stackexchange.com/questions/17247/spsite-allwebs-returns-error

Tagged ,

SharePoint – PeopleZen This months birthdays

Hello everyone. Today I´m going to show you how you can create a Webpart page showing this months birthdays by using 2 SharePoint 3rd party products called FilterZen and PeopleZen.

But First: I want to thank all of you for your kind words and comments.  They made me really happy. Thank you 🙂 I´ll try to answer all of them soon.

Okay. Let´s get down to business.

The first thing you need to do is to download the following products:

Important: You will also need to setup the User Profile Service and import some profiles to test you configuration.

Simply run the Setup Wizard of the products as Administrator on your SharePoint server and deploy the solutions and you are ready to go.

Now go to your SharePoint site.

sharepoint_peoplezen_features_deactivated

Go to Site Collection features and activate the following features:

  • [Roxority] FilterZen Filter Web Part
  • [Roxority] PeopleZen Web Part

sharepoint_peoplezen_features_activated

Now go back to your SharePoint Site and add the following Web Parts:

  • [Roxority] FilterZen Web Part
  • [Roxority] PeopleZen Web Part

sharepoint_peoplezen_add_webparts

Next Edit the PeopleZen Webpart and choose Connections -> Get Filters From -> <Your FilterZen Web Part>.

sharepoint_peoplezen_create_connections

Next the following dialogue will open:

sharepoint_peoplezen_send_values

Choose Send Filter Values To as Connection Type and click on Finish.

sharepoint_peoplezen_add_birthday

Next Edit the PeopleZen Web Part and go to User Profile Properties. And now choose Birthday in the dropdown list below Add known field:

sharepoint_peoplezen_ignore_year_day

Now check the following checkboxes:

  • Ignore year when filtering by date range fields (such as hire date or birthday) for annually recurring dates
  • Ignore day when filtering by date range fields (such as hire date or birthday) for “any date in month X” 

sharepoint_peoplezen_caml

The next step is to edit the FilterZen Web Part and choose CAML Direct filtering mode as Filter Mode.

sharepoint_peoplezen_add_date_filter

Next add a new Date Filter.

sharepoint_peoplezen_date_filter_properties

Now enter SPS-Birthday as value for the Column / filter name textbox. And enter today as value for the default date filter value(s) textbox.

sharepoint_peoplezen_date_filter_advanced

Now go to Advanced Filter Properties and make sure that the value for filter operator is set to equals.

To finish your settings click on Apply and OK.

sharepoint_peoplezen_finished

That´s it. Your finished Web Parts will now display all user profiles of users whose birthday is this month. I hope you liked my post. See you next time.

Sources:

http://roxority.com/peoplezen/

http://roxority.com/filterzen/

Tagged

SharePoint – Change Date Format

Hello everyone. A while ago I got the request to change the date format of SharePoint. The company I´m working for has all SharePoint Site Collections setup using the Culture en-US and therefore the date format looks like this: MM/dd/yyyy. Since this date format can be quite confusing for our international employees we decided to replace it with the ISO8601 date format. The solution was quite simple:

Prerequisites:

  • Microsoft Visual Studio

The first thing you need to do is to create a new Console Application.

The next thing you need to to is to add a reference to sysglobl.dll.

And here is the code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;

namespace DateTimeFormat
{
class Function
{
public void SetDateFormatISO8601()
{
try
{
CultureAndRegionInfoBuilder.Unregister("en-US");
}
catch
{
}

CultureAndRegionInfoBuilder builder = new CultureAndRegionInfoBuilder("en-US", CultureAndRegionModifiers.Replacement);
builder.LoadDataFromCultureInfo(new CultureInfo("en-US"));
builder.LoadDataFromRegionInfo(new RegionInfo("en-US"));
builder.GregorianDateTimeFormat.ShortDatePattern = "yyyy-MM-dd";
builder.Register();
}

public void SetDateFormatAmerican()
{
try
{
CultureAndRegionInfoBuilder.Unregister("en-US");
}
catch
{
}

CultureAndRegionInfoBuilder builder = new CultureAndRegionInfoBuilder("en-US", CultureAndRegionModifiers.Replacement);
builder.LoadDataFromCultureInfo(new CultureInfo("en-US"));
builder.LoadDataFromRegionInfo(new RegionInfo("en-US"));
builder.GregorianDateTimeFormat.ShortDatePattern = "MM/dd/yyyy";
builder.Register();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DateTimeFormat
{
 class Program
 {
 static void Main(string[] args)
 {
 Function function = new Function();

 string Choice = string.Empty;
 Console.WriteLine("Set Date format of Site Collection:");
 Console.WriteLine("-----------------------------------");
 Console.WriteLine("1) Set Date format to ISO8601 standard format (yyyy-MM-dd)");
 Console.WriteLine("2) Set Date format to default american format (MM/dd/yyyy)");
 Console.WriteLine();
 Console.WriteLine("Choose a number:");
 Choice = Console.ReadLine();
 Console.WriteLine();

 if(Choice == "1")
 {
 function.SetDateFormatISO8601();

 Console.WriteLine("Done");
 Console.ReadLine();
 Console.WriteLine();
 }
 else if (Choice == "2")
 {
 function.SetDateFormatAmerican();

 Console.WriteLine("Done");
 Console.ReadLine();
 Console.WriteLine();
 }
 else
 {
 Console.WriteLine("Invalid input");
 Console.ReadLine();
 Console.WriteLine();
 }
 }
 }
}

That´s it. Your code is ready to use.

Please remember to run the code as Administrator. Otherwise the User Account Control will stop your program.

After you have successfully run the code you need to run cmd as Administrator and run the following command:

iisreset

That´s it. Now all Site Collections configured to use the Culture en-US will display their date format like this: yyyy-MM-dd.

Important: I did not come up with the code above. I just used the code I found here. The post was pretty useful for me so I thought I should share it.

I hope my post was useful for you and as always you can download my code from here.

Sources:

http://www.matdesmarais.com/2011/12/changing-the-date-display-format-in-sharepoint-2010/

Tagged ,

Nintex Workflow – Enable Lazy Approval

Hi everyone. Today I want to show you how you can setup Nintex Workflows Lazy Approval feature. The Lazy Approval feature allows your users to reply to mails sent by User Interaction Tasks (like Flexi Task) with a valid term to either Approve or Reject the Action.

Since this feature is pretty popular I thought I should post about how to set it up so you can enable this feature for your users.

Prerequisites:

  • You will need an E-Mail Server for your test users. (I explained how to setup a simple Development Mail Server here.)
  • Nintex Workflow installed on your SharePoint Web Servers (I blogged about this topic here.)

SMTP Server Installation

The first thing you need to do is to install the Windows Feature SMTP Server on your SharePoint Web Server (in my example the Web Server is called: sp.intranet.com).

nintex_workflow_lazy_approval_install_smtp

Check the Advanced Settings in the Delivery Tab of IIS6 Manager if the FQDN of your SharePoint Web Server is entered correctly and you´re good to go.

Important: Make also sure that the Simple Mail Transfer Protocol services Startup Type is set to Automatic to make sure the service will be started when you reboot your server.

nintex_workflow_lazy_approval_delivery

That´s it. Your SharePoint Web Server is ready.

Central Administration Settings

Open up your SharePoint Central Administration and open up the Incoming E-Mail Settings page.

Now choose Yes and Automatic for Enable Incoming E-Mail and click on OK.

nintex_workflow_lazy_approval_incoming_mail

Next go to the Outgoing E-Mail Settings page.

Now enter the name of your E-Mail server in the Outbound SMTP server text box. (I chose my Development Mail Server smtp.intranet.com I used in this blog post.)

nintex_workflow_lazy_approval_outgoing_mail

Now go to your Nintex Workflow Management page and go to LazyApproval Settings and click on Enable / Disable LazyApproval for the current server farm.

nintex_workflow_lazy_approval_enable_lazy_approval

Now enter the E-Mail address which shall be used by the Lazy Approval feature and click on OK.

nintex_workflow_lazy_approval_enable_lazy_approval_mail

After you have clicked on OK your will be redirected to the LazyApproval Settings page. On this page you can configure terms which your users can use to respond to workflow tasks.

nintex_workflow_lazy_approval_terms

That´s it. The Lazy Approval feature is now ready to use.

Example Workflow

To test the Lazy Approval feature just create a new Nintex Workflow.

nintex_workflow_lazy_approval_test_workflow_creation

Add a Flexi task feature and open the Configuration page of the Flexi task.

nintex_workflow_lazy_approval_test_workflow_finished

Now check the check box next to Allow Lazy Approval and click on OK.

nintex_workflow_lazy_approval_flexi_task_enable

Now Publish your Workflow and start it.

nintex_workflow_lazy_approval_test_workflow_start

Your users will receive a mail like the below one:

nintex_workflow_lazy_approval_mail

Now all your users need to do is to Reply on this mail with a valid term. For example: yes to Approve the task.

nintex_workflow_lazy_approval_mail_response

As you can see our Example Workflow took the Approve route as expected.

nintex_workflow_lazy_approval_test_workflow_mail_approve

Here is the overview of the Workflow:

nintex_workflow_lazy_approval_test_workflow_completed

That´s it. It is as easy as this to enable Lazy Approval for your users. I hope you liked my post. See you next time.

Sources:

http://sharepointjeff.blogspot.co.at/2014/02/nintex-setting-up-lazy-approval.html

Tagged ,

Windows Server – Setup Mail Server for Development environment

Hi everyone. Today I want to show you how you can set up a simple Mail Server for your development environments.

To set up a simple Mail Server you need to do the following:

  • Setup Windows Server 2008R2 and give it a name you can easily remember (I chose smtp.intranet.com as name for my server)
  • Download Visendo SMTP Extender from here.

Installation of SMTP Server feature

Install the Windows Feature SMTP Server.

mail_server_install_feature_smtp

Now open IIS 6 Manager.

mail_server_iis6

Now select [SMTP Virtual Server #1] and click on Properties.

Now go to the Access tab and click on Relay…

Now make sure to enable the setting All except the list below and make sure to check the checkbox at the end of the window and click OK.

mail_server_iis6_access

Now go to the Delivery tab and click on Advanced…

The name of your server (the name of mine is smtp.intranet.com) will be entered in the Fully-qualified domain name text box. If not make sure to enter it and click on OK.

mail_server_iis6_delivery

Now open up Services and make sure the Startup Type of the service Simple Mail Transfer Protocol is set to Automatic.

mail_server_smtp_service_automatic

Installation of Visendo SMTP Extender

The Installation is pretty simple. Simply download the Installer mentioned above and run the Setup Wizard.

After the installation has finished open up the Visendo Configuration Wizard.

mail_server_visendo_accounts

Now create a new account.

mail_server_visendo_new_account

After you have created your accounts go to Settings and click on Start.

mail_server_visendo_start

Now go to Services and make sure that the Startup type of the service Visendo SMTP Extender is set to Automatic.

mail_server_visendo_service_automatic

Configuration of Windows Firewall

To make sure that your Mail Server will work as expected you need to allow POP3.

Create a new Inbound Rule in Advanced Settings of Windows Firewall.

Choose Port and click on Next.

mail_server_firewall_inbound_port

Now choose TCP and enter 110 in the Specific local ports text box.

mail_server_firewall_inbound_tcp_110

Now choose Allow the connections.

mail_server_firewall_inbound_allow

In the last step I checked Domain, Private and Public.

mail_server_firewall_inbound_profile

Client Setup

On your client machine start Microsoft Outlook.

mail_server_client_wizard_start

Now choose Yes and click on Next.

mail_server_client_wizard_yes

Now choose Internet E-mail and click on Next.

mail_server_client_wizard_internet

Now choose Manually configure server settings or additional server types and click on Next.

mail_server_client_wizard_manually

Now enter your account information like shown in the below screenshot and click on Next.

mail_server_client_wizard_account_settings

Now Microsoft Outlook will check if it is able to connect to your Mail Server and send an test E-mail.

mail_server_client_wizard_test_account_settings

If all tests are successful your configuration is finished and you are ready to go.

mail_server_client_wizard_finished

That´s it. Your Mail server and your client are now ready to use.

Sources:

http://jebass.blogspot.co.at/2009/02/making-pop3-smtp-server-work-with.html

http://www.visendo.com/VisendoDownloads.aspx?id=42

Tagged

Nintex Workflow for SharePoint – Installation

Hi everyone. Today I want to show you ho you can setup your own Nintex Workflow Development environment. I thought a short tutorial would be good since you can easily run into errors when you miss a step.

As you may know Nintex Workflow is one of the most popular 3rd party products for SharePoint and a pretty good workflow engine. To setup your own Development environment you need to do the following:

Getting a Development license

You can get a Development license from here. All you need to do is to fill out a form with your personal data. After you have sent your data to Nintex you will receive an Email containing your license file and a download link of the Nintex Workflow product.

Important: Nintex does not accept free Mail addresses like googlemail.com in their Development license request form and the Development license will lose its validity after 30 days.

The Installation

Important: Nintex Workflow needs to be installed on every SharePoint Web Server in your SharePoint Farm.

Before you start the Install Wizard you need to do the following:

Set the User Account Control settings on the lowest level and reboot your server. If you miss this step you might run into errors preventing the Install Wizard from adding the solution files to your farm.

nintex_workflow_install_uac

Now run the Install Wizard as a SharePoint Farm Administrator and wait till the Wizard has finished his work.

nintex_workflow_install_wizard_finish

Important: After the installation has finished you should set your User Account Control settings back to the Default value and remember to reboot your server.

As you can see the solutions have been added to your farm.

nintex_workflow_install_solution_not_deployed

Now you need to deploy them globally. (Just click on the link and choose Deploy.)

nintex_workflow_install_solution_deployed

Now you need to import your license.

nintex_workflow_install_license

The next step is to create a database where the Nintex product can store its data.

nintex_workflow_install_db_create

As you can see in the below screenshot the database setup will look like this:

nintex_workflow_install_db_ready

Now you need to activate Nintex Workflow on every Web Application you want to use it.

nintex_workflow_install_web_activation

Now go to Manage Allowed Actions and check every action you want to allow to be used in your workflows.

nintex_workflow_install_manage_allowed_actions

Activating the features

Now go to your Site Collection where you want to use Nintex Workflow.

Activate the following Site Collection features:

  • Nintex Workflow 2010

nintex_workflow_install_site_collection_feature

Activate the following Site features on the Sites where you want to use Nintex Workflow:

  • Nintex Workflow 2010

nintex_workflow_install_site_feature

That´s it. Your Development environment is now ready to use.

I hope today´s post was interesting for you. See you next time.

Sources:

http://www.nintex.com/en-US/Pages/default.aspx

Tagged ,

SharePoint – Replace Link on Wiki Page

Hello everyone. A while ago I was asked by a colleague if there is a way to replace an old link with a new one in many Wiki pages. He asked me because he needed to replace an old link in a library with hundreds of pages. Pretty hard work if you need to do this manually but fortunately there is a way to do this automatically by using PowerShell.

In the below screenshot you can see one of the example pages which are created when you create a new Wiki Library. And we will try to replace the link I marked with a new one.

sharepoint_wiki_link_before

To do so we run PowerShell as Administrator (on one of your SharePoint servers) and run my script WikiPageReplaceString.ps1.

sharepoint_wiki_replace_string_script

As you can see the script successfully replaced the link with the new value.

sharepoint_wiki_link_after

And here is the script code:

Param([parameter(Mandatory=$true)][alias("Url")]$SPWebUrl, [parameter(Mandatory=$true)][alias("ListName")]$SPListName, [parameter(Mandatory=$true)][alias("Search")]$SearchString, [parameter(Mandatory=$true)][alias("Replace")]$ReplaceString)

#Add SharePoint PowerShell SnapIn if not already added
if((Get-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin Microsoft.SharePoint.PowerShell
}

#Get SharePoint website object
$SPWeb = Get-SPWeb $SPWebUrl
#Get SharePoint list object
$SPList = $SPWeb.Lists[$SPListName]

#Iterate through each item in the Wiki Library
foreach($SPListItem in $SPList.Items)
{
#Check if $SPListItem contains $SearchString
if($SPListItem["ows_WikiField"] -and $SPListItem["ows_WikiField"].contains($SearchString))
{
#Check out page
$SPListItem.File.CheckOut();

#Replace $Search_String with $Replace_String and update item
$SPListItem["ows_WikiField"] = $SPListItem["ows_WikiField"].replace($SearchString, $ReplaceString);
$SPListItem.Update();

#Check in page
$SPListItem.File.CheckIn("Checked in by System.");
}
}

The script basically does the following:

It will iterate through each item in your Wiki library and check if the string you are searching for exists in the content. If the string is present it will check out the item and replace the string with the new value you entered. After it successfully replaced the string the script will check in your item again and repeat theses steps for the next item until all items have been checked.

Pretty simple, right? So next time you need to update your Wiki libraries you will have this script to do the work for you. I hope you liked my post and as always you can download my script from here.

Sources:

http://blogs.technet.com/b/sp/archive/2013/05/29/http-www-blogger-com-blogger-g-blogid-8070685728411204795-editor-target-post-postid-1574709978165689298-onpublishedmenu-overviewstats-onclosedmenu-overviewstats-postnum-38-src-postname.aspx

http://sharepoint.stackexchange.com/questions/32945/sharepoint-2010-custom-wiki-library

Tagged ,