Tag Archives: Best SharePoint Hosting

SharePoint 2013 Hosting – ASPHostPortal.com :: How to Add or Remove A New User to SharePoint Group Using Powershell Script

How to Add or Remove A New User to SharePoint Group Using Powershell Script

In SharePoint site you can see usually a lot of groups. Sometimes administrator gets a task to add user to several groups. If it’s 3-5 groups you can do it manually, but if you need to add user to 30 groups? I’m too lazy to do it manually and too smart not do it at all.

SharePoint 2013 Hosting

  1. Start your windows PowerShell on your computer.
  2. Right click and select Run as administrator option.
  3. Paste the below script on the PowerShell window and click the enter button.
  4. Check your SharePoint site Feature will activated successfully.

So let’s start out PowerShell ISE and connect SharePoint CMD-let:

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) 
{ 
 Write-Host "Connect Sharepoint cmd-Let" 
 Add-PSSnapin Microsoft.SharePoint.PowerShell 
}

Let’s enter site collection url, username for inserting to groups and get array of destination SharePoint groups. For example, let this groups contain a string “admin”

$url = "http://user"
$userName = "user\testuser1"
$site = new-object Microsoft.SharePoint.SPSite($url) 
$web = $site.OpenWeb() 
$groups = $web.sitegroups
write-host "------get array of groups which contain a string "admin"-----" 
$myGroups = @(); 
foreach($group in $groups) { 
if($group -match "admin") { 
$myGroups += $group 
}

Go through each element of array and add user to SharePoint group

foreach ($gr in $myGroups) { 
#add user to SP Group
 Set-SPUser -Identity $userName -web $url -Group $gr 
 write-host "User " $userName "added to " $gr 
}

And if you made a false and, for example, entered wrong username, you can easily remove user from SharePoint groups with this PS-code:

foreach ($gr in $myGroups) { 
 $theGroup = $web.SiteGroups[$gr] 
 $theUser = $web.AllUsers.Item($userName) 
#Remove user from SP Group
 $theGroup.RemoveUser($theUser); 
 write-host "User " $userName " removed from " $gr
}

If you don’t want to collect these pieces here’s a full version:

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) 
{ 
 Write-Host "Connect Sharepoint cmd-Let" 
 Add-PSSnapin Microsoft.SharePoint.PowerShell 
}
$url = "http://user"
$site = new-object Microsoft.SharePoint.SPSite($url) 
$web = $site.OpenWeb() 
$groups = $web.sitegroups 
$userName = "user\testuser1" 
write-host "--------------" 
$i = 0; 
$myGroups = @(); 
foreach($group in $groups) { 
 if($group -match "admin") { 
 $myGroups += $group 
 } 
} 
foreach ($gr in $myGroups) { 
 write-host $gr 
#add user to SP Group
 Set-SPUser -Identity $userName -web $url -Group $gr 
 $theGroup = $web.SiteGroups[$gr] 
 $theUser = $web.AllUsers.Item($userName) 
#Remove user from SP Group
# $theGroup.RemoveUser($theUser); 
 write-host "User " $userName "added to " $gr 
}

If there are non-english letters in a group name or if the group you need is on another site (but in this site collection), then you can have error on Set-SPUser command. In this case I can advice you to use another command $web.SiteGroups[group name].AddUser(user)

foreach ($gr in $myGroups) { 
 Write-Output "Группа: $gr " 
#alternative way to add user to SP Group 
 $theUser = $web.AllUsers.Item($userName)
 $web.SiteGroups[$gr].AddUser($theUser) 
 Write-Output "User $userName added to $gr" 
}

Cheap and Recommended SharePoint 2013 Hosting

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability.

Sharepoint 2013 Hosting – ASPHostPortal.com :: User Profile Property Cannot be Deleted in SharePoint 2013

If you run into the problem that you can’t delete properties within the User Profile Service Application, an Exception like this will be shown:

User Profile Property Cannot be Deleted in SharePoint 2013

The delete operation failed, please try again later. If the problem persists, please contact your administrator.

To resolve the problem, grant “Full Control” permissions to the administrative Applicationpools group (WSS_WPG).

User Profile Property Cannot be Deleted in SharePoint 2013 2

Now you should be able to delete properties again.

Cheap and Recommended SharePoint 2013 Hosting

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting – ASPHostPortal.com :: How to Fix SharePoint 0x8004010F Error

Task ‘SharePoint‘ reported error (0x8004010F) : ‘The SharePoint List  cannot be found. If the problem continues, contact the SharePoint site administrator. HTTP 404.

Issue: connected SharePoint Lists with the Outlook and we open the Outlook we see the error sometimes” Task ‘SharePoint’ reported error (0×80040102) : ‘Outlook cannot connect to the SharePoint List (site name – list name). The server may not be reachable from your location. Contact the SharePoint site administrator for more information. HTTP 0.

Cause: The issue could be of many reasons. find the below

1.   Could be the Lists is not connected properly with outlook
2.   Could be the list is removed
3.   make sure that all user accounts requesting have proper permissions

Solution: Ensure to check the following steps to resolve the issue.
If you no longer have to synchronize with the specific SharePoint list mentioned in the error, follow these steps to remove the SharePoint list from Outlook:

1.   Select Tools, and then click Account Settings.
2.   Click Account Settings, and then click SharePoint Lists.
sharepoint eror
3.   In the Account Settings dialog box, double-click the SharePoint list for which you received the error.
4.   Clear the check on Display this list on other computers with the account: and then click OK.
5.   Make sure that the SharePoint list for which you received the error is still selected, and then click Remove.
6.   Close the Account Settings dialog box

Cheap and Recommended SharePoint 2013 Hosting

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting – ASPHostPortal.com :: How to Fix SharePoint Cannot Show The Value of Filter

Multi-valued PeoplePicker Column that can be filtered using PowerShell

Recently I came across an error while filtering the multi-valued PeoplePicker column. The error reads “Cannot show the value of filter“. The field may not be filterable, or the number of items returned exceeds the list view threshold enforced by the administrator.” There are only four values in the column, surely it has no relation to the list view threshold value.

ahp banner sharepoint-01

Internally, SharePoint server uses “_layouts/filter.aspx” application page for filter values which are presented in an iFrame. I checked the ULS logs and copied the Request URL with filter.aspx. I pasted it in browser and hit “Enter”. It returned no result.

What is multi-valued field?

The field which allows more than one values or which allows multiple selections. The multi-valued fileds are non-sortable, non-filterable. Multi-valued fields cannot be indexed.

How to Fix

This behavior can be overridden. Every field has an associated schema. Multi-valued fields are marked as “Sortable =false” in the schema for performance reasons. Note: Apply the workaround wherever it is unavoidable.

If we mark the multi-valued PeoplePicker as “Sortable=true”, the column turns filterable/ sortable. This can be achieved using SharePoint Server Object Model or using Windows PowerShell (I love it).

PowerShell Script to mark the column as Sortable:

$web=Get-SPWeb <weburl>
$list=$web.Lists[<list title>]
$field=$list.Fields[<field title>]
$strSchema=$field.SchemaXml
$str=Schema$strSchema.Replace(“Sortable=`”FALSE`””,”Sortable=`”true`””)
$field.SchemaXml = $strSchema

Update: I noticed that multi-valued “person or group” column in other web application was showing filter choices even though “Sortable=false”. Googling did not help. I checked at various levels and found that “Online Presence” setting causes this error. If Online presence setting is turned OFF, SP 2010 starts showing this error for multi-valued columns when tried to filter. So turn it ON, and no error, filter choices are shown back. The Online Presence setting is available in Web applications’s General Settings.

Cheap and Recommended SharePoint 2013 Hosting

ASPHostPortal.com
ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting – ASPHostPortal.com :: How to Configures Refining SharePoint Search and Searchable Columns

Adding search refiners and creating searchable columns with SharePoint On the web can be a small bit diverse then with SharePoint 2013 on premise. In this blog post I’ll clarify how to add search refiners and the best way to make custom columns searchable. You will find 5 significant components we ought to implement

ahp banner sharepoint-01

  • Create a custom column
  • Add some content
  • Map a crawled property to a refinable managed property
  • Created the alias
  • Configure the refiners

Solution

  1. Create your custom column, for example Product.
  2. Create some content with the custom column.
  3. Wait for the column to be added as a crawled property, this might take up to 24 hours.
  4. Open the SharePoint admin center and click on Search.
    1hdvl
  5. Click on Manage Search Schema.
  6. Depending on the type of column you will need to use different type of preset Managed Properties.
    Managed property name Data type for mapping
    RefinableDate00 – RefinableDate19 Dates.
    RefinableDecimal00 – RefinableDecimal09 Numbers with max three decimals.
    RefinableDouble00 – RefinableDouble09 Numbers with more than three decimals.
    RefinableInt00 – RefinableInt49 Whole numbers.
    RefinableString00 – RefinableString99 Strings, Person or Group, Managed Metadata, Choice and Yes/No
  7. Search the related type on Managed Property.
    2ksdhvp
  8. Click on Edit Map Property in het drop-down menu.
  9. Add the Crawled property of the custom column, in our example it will be ows_Product.
    3jkbnl;fc
  10. Fill in the alias, this will make the column searchable.
  11. Save the changes.
  12. Close the SharePoint admin center and open the search center result page.
  13. Set the page in edit modus and edit the Refinement web part.
    4dkjvb
  14. Click on Choose refiners, and add the managed property, in this example RefinableString01
  15. Change the display name to the custom columns name, otherwise the refiner will be shown as RefinableString01
  16. Search for some content and enjoy the result!

Result

5jkbsdvloBest Recommended SharePoint 2013 Hosting

ASPHostPortal.com
ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting – ASPHostPortal.com :: Deploying Managed Metadata Fields Declaratively

In this article, we will see how we are able to deploy Managed metadata fields in a declarative way in SharePoint

A managed metadata column lets you handle the data that people can enter into a column. Users select the terms or phrases that they enter within the column from a pre-defined set of managed terms.

ahp banner sharepoint-01The challenge comes if you desire to provision your custom managed metadata navigation field inside a declarative way, and adding this column to a content variety or a list instance without having losing all the strong functions that comes along making use of this field sort.

Out on the Box, if you added a managed column for your list SharePoint performs some actions behind the scene:

Creates a hidden note field attached to your column
Attached your list to two event receivers to update the taxonomy hidden list .
Fills in some properties related to the current web and taxonomy list id
Creates a taxonomy search managed  property after a full crawl that could be used as a refiner or even as a category column if you are planning to use the Product Catalog model.

So you’ll find a lot of articles explaining how you can deploy Managed Metadata Fields declarative in SharePoint, but they are scattered, so I decided to aggregate all of the suggestions and tricks to cover this activity.

  • Taxonomy Field  declarative XML, no tricks here

    <Field ID=”{20A3C69E-FFFB-43F4-BBDF-2D22BAF0EB84}”
    Type=”TaxonomyFieldType”
    DisplayName=”$Resources:myResourceFile,EventType”
    ShowField=”Term1033″
    Required=”TRUE”
    EnforceUniqueValues=”FALSE”
    Group=”Custom”
    StaticName=”CustomEventType”
    Name=”CustomEventType”
    Filterable=”TRUE”
    Sortable=”TRUE” />

  • SharePoint creates a hidden note field to be field with chosen values even though filling the taxonomy field, right here comes the tricky element, although adding your custom field towards the list you must add this hidden field in addition to it, The Display name need to comply with the following convention ‘TaxonomyField_0′ and the static name should adhere to the following convention ‘TaxononmyFieldTaxHTField0′, without having following this conventions SharePoint search will not create the crawled property for your custom column ‘ows_taxId_CustomEventType’, and for certain will not generate the managed house

    ‘owstaxidKataraEventType’<Field ID=”{09F37A61-50FE-413E-941F-3BEE2A1B5BF8}”
    Name=”CustomEventTypeTaxHTField0″
    StaticName=”KataraEventTypeTaxHTField0″
    SourceID=”http://schemas.microsoft.com/sharepoint/v3/fields”
    Type=”Note”
    DisplayName=”CustomEventType_0″
    Group=”Katara”
    Hidden=”TRUE” />

  • Soon after declaring the schema of each field you must get them connected together, and ought to attach the developed column to a specific Term Set and distinct Term to choose from as a source, this could possibly be achived by adding a function event receiver making use of the following code snippet.SPSite site = properties.Feature.Parent as SPSite;

    Guid eventFieldId = new Guid(“{20A3C69E-FFFB-43F4-BBDF-2D22BAF0EB84}”);if (site.RootWeb.Fields.Contains(eventFieldId))
    {
    TaxonomySession session = new TaxonomySession(site);
    if (session.TermStores.Count != 0)
    {
    var termStore = session.TermStores["Managed Metadata Serivce"];
    var group = termStore.Groups["YOUR GROUP NAME"];
    var termSet = group.TermSets["YOUR TERM SET NAME"];var eventTypeTerm = termSet.Terms["THE TERM NAME CONTAINING YOUR VALUE"];

    TaxonomyField eventField = site.RootWeb.Fields[eventFieldId] as TaxonomyField;

    //Attach the note field to the taxonomy field
    eventField.TextField = new Guid(“{09F37A61-50FE-413E-941F-3BEE2A1B5BF8}”);

    // Connect to MMS
    eventField.SspId = termSet.TermStore.Id;
    eventField.TermSetId = termSet.Id;
    eventField.TargetTemplate = string.Empty;
    eventField.AnchorId = eventTypeTerm.Id;
    eventField.LookupWebId = site.RootWeb.ID;

    if (eventField.TypeAsString == “TaxonomyFieldTypeMulti”)
    ageGroupField.AllowMultipleValues = true;

    eventField.Update();
    }
    }

  • Within this stage we’ve got our field provisioned and added to our site as a web site column, the next step is usually to add it to a content sort, the trick here is we should add two hidden fields ‘TaxCatchAll’ & ‘TaxCatchAllLabel’ fields,If it doesn’t, then you won’t get facets showing up correctly in faceted search. Note that not having the TaxCatchAll and TaxCatchAllLabel pair of columns in your list or library or content variety can cause that.
  • so our field references will probably be like the following

    <FieldRef ID=”{20A3C69E-FFFB-43F4-BBDF-2D22BAF0EB84}” DisplayName=”$Resources:FILENAME_Columns,EventType;” Required=”TRUE” Name=”CustomEventType” Filterable=”TRUE” Sortable=”TRUE” />
    <FieldRef ID=”{09F37A61-50FE-413E-941F-3BEE2A1B5BF8}” DisplayName=”CustomEventType_0″ Hidden=”TRUE” Name=”CustomEventTypeTaxHTField0″ />
    <FieldRef ID=”{f3b0adf9-c1a2-4b02-920d-943fba4b3611}” DisplayName=”Taxonomy Catch All Column” Required=”FALSE” Hidden=”TRUE” Name=”TaxCatchAll” Sealed=”TRUE” Sortable=”FALSE” />
    <FieldRef ID=”{8f6b6dd8-9357-4019-8172-966fcd502ed2}” DisplayName=”Taxonomy Catch All Column1″ Required=”FALSE” Hidden=”TRUE” Name=”TaxCatchAllLabel” ReadOnly=”TRUE” Sealed=”TRUE” Sortable=”FALSE” />

  • Now we come to the next trick, referencing these columns to a list template within the schema.xml file , the trick right here would be to declare the TaxHiddenList ‘TaxCatchAll’ & ‘TaxCatchAllLabel’ correctly to the the list schema, these fields are a lookup columns so they need the information list (source), following is the definetion, NOTE the List attribute.

    <Field Type=”LookupMulti” DisplayName=”Taxonomy Catch All Column” StaticName=”TaxCatchAll” Name=”TaxCatchAll” ID=”{f3b0adf9-c1a2-4b02-920d-943fba4b3611}” ShowInViewForms=”FALSE” List=”Lists/TaxonomyHiddenList” Required=”FALSE” Hidden=”TRUE” CanToggleHidden=”TRUE” ShowField=”CatchAllData” SourceID=”{1e46f7fe-3764-40b5-abd1-1746c716214b}” Mult=”TRUE” Sortable=”FALSE” AllowDeletion=”TRUE” Sealed=”TRUE” Version=”2″ />
    <Field Type=”LookupMulti” DisplayName=”Taxonomy Catch All Column1″ StaticName=”TaxCatchAllLabel” Name=”TaxCatchAllLabel” ID=”{8f6b6dd8-9357-4019-8172-966fcd502ed2}” ShowInViewForms=”FALSE” List=”Lists/TaxonomyHiddenList” Required=”FALSE” Hidden=”TRUE” CanToggleHidden=”TRUE” ShowField=”CatchAllDataLabel” FieldRef=”{F3B0ADF9-C1A2-4b02-920D-943FBA4B3611}” SourceID=”{1e46f7fe-3764-40b5-abd1-1746c716214b}” ReadOnly=”TRUE” Mult=”TRUE” Sortable=”FALSE” AllowDeletion=”TRUE” Sealed=”TRUE” Version=”2″ />

  • Finally, we require to attache the “TaxonomyItemSynchronousAddedEventReceiver” & “TaxonomyItemUpdatingEventReceiver” to update all the hidden fields.

    <Receiver>
    <Name>TaxonomyItemSynchronousAddedEventReceiver</Name>
    <Type>ItemAdding</Type>
    <Assembly>Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
    <Class>Microsoft.SharePoint.Taxonomy.TaxonomyItemEventReceiver</Class>
    <SequenceNumber>10000</SequenceNumber>
    </Receiver>
    <Receiver>
    <Name>TaxonomyItemUpdatingEventReceiver</Name>
    <Type>ItemUpdating</Type>
    <Assembly>Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
    <Class>Microsoft.SharePoint.Taxonomy.TaxonomyItemEventReceiver</Class>
    <SequenceNumber>10000</SequenceNumber>
    </Receiver>

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com
ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting :: How To Update Conflict Error in SharePoint Using PowerShell Script

Hi guys this article explains you about How To Update Conflict Error in SharePoint Using PowerShell Script. Many of you must have come across the issue “An update conflict has occurred and you must re-try this action” and it is suggested to remove the file system cache on the front-end servers. There are many articles to show how to do this manually. But here I will show you how to resolve it using a PowerShell script.

Cause for this issue

This issue occurs if the contents of the file system cache on the front-end servers are newer than the contents of the configuration database.

Resolution

To resolve this issue, clear the file system cache on all servers in the server Farm on which the Windows SharePoint Services Timer service is running. This can be done manually, but consider a large Farm where the administrator needs to login to each of the servers to perform the activity manually. It is time-consuming and people can make mistakes. PowerShell becomes handy here.

The following procedure can resolve the issue:

  1. Stop the SharePoint timer service
  2. Take a backup of the system cache files before deleting it
  3. Delete the XML files from the cache folder
  4. Reset the cache.ini file to the value 1
  5. Start the SharePoint timer service

Now I will explain how to perform the preceding tasks using a PowerShell script.

  • Stop SharePoint timer service

The following piece of code stops the SharePoint timer service:

    Function StopSPTimerServicesInFarm([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-Host ""  
        foreach($server in $farm.Servers)  
            {  
            foreach($instance in $server.ServiceInstances)  
                    {  
                            # If the server has the timer service then stop the service  
                           if($instance.TypeName -eq $timerServiceInstanceName)  
                           {  
                                [string]$serverName = $server.Name  
       
                                Write-Host "Stop " $timerServiceName " service on server: " $serverName -fore yellow  
                                   
                                $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                                $serviceInternalName = $service.Name  
                                sc.exe \\$serverName stop $serviceInternalName > $null  
      
                                  # Wait until this service has actually stopped  
                      write-host "Waiting for '$timerServiceName' service on server: " $serverName " to be stopped" -fore yellow  
                                  do  
                          {  
                                  Start-Sleep 1  
                                  Write-Host -foregroundcolor DarkGray -NoNewLine "."  
                                  $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                          }  
                         while ($service.State -ne "Stopped")  
                     write-host " '$timerServiceName' service on server: " $serverName " stopped successfully" -fore green              
                                 break;  
                           }  
                    }  
            }  
       
            Write-Host ""  
    }
  • Backup config cache files

The following piece of code backs up the config cache files before deleting it:

Function BackupSPConfigFiles([Microsoft.SharePoint.Administration.SPFarm]$farm)  
{  
    write-host ""  
    write-host "Backup SP config cache files" -fore yellow  
      
    foreach($server in $farm.servers)  
    {  
        foreach($instance in $server.ServiceInstances)  
        {  
            if($instance.TypeName -eq $timerServiceInstanceName)  
            {  
                $ServerName = $server.name  
                $FolderName  = $servername + "SPConfigCacheBackup"  
                write-host "Creating a folder to hold the backup files" -fore magenta  
                write-host "Checking whether the folder aleady exist"  
                if(Test-path $scriptbase\$FolderName)  
                {  
                    write-host "Folder already exists and the script is deleting it......"  
                    remove-item $scriptbase\$FolderName -recurse -confirm:$false   
                    write-host "Existing folder deleted" -fore green  
                }  
                else  
                {  
                    write-host "Folder does not exist"  
                }  
                New-Item $scriptbase\$FolderName -type directory  
                write-host "New folder created to hold the backup files" -fore magenta  
                write-host "Backup of SP config files for the server " $serverName " started ...... " -fore yellow  
                $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config"  
                Copy-Item $path -Destination $scriptbase\$FolderName -recurse  
                write-host "SP config cache files backed up for the server " $serverName " Sucessfully..." -fore green  
            }  
        }  
    }  
    write-host "SP config caches files are backed up" -fore green  
    write-host ""  
}
  • Deleting XML files

The following piece of code deletes the XML files:

    Function DeletingXMLFiles([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-host ""  
        write-host "Deleting SP config cache XML files from each server in the farm" -fore yellow  
        $path = ""  
        foreach($server in $farm.servers)  
        {  
            foreach($instance in $server.ServiceInstances)  
            {  
                if($instance.TypeName -eq $timerServiceInstanceName)  
                {  
                    $serverName = $server.Name  
                    write-host "Deleting SP config cache files from the server " $servername -fore magenta  
                    $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config\*-*\*.xml"  
                    remove-item -path $path -force  
                    write-host "SP config cache files deleted on the server " $servername -fore magenta  
                    break  
                }  
            }  
        }  
        write-host "SP config cache XML files from each server in the farm is deleted successfully......" -fore green  
        write-host ""  
    }
  • Reset timer cache

The following piece of code resets the timer cache:

Function ResetTimerCache([Microsoft.SharePoint.Administration.SPFarm]$farm)  
{  
    write-host ""  
    write-host "Reseting the value of timer cache to 1" -fore yellow  
    $path = ""  
    foreach($server in $farm.servers)  
    {  
        foreach($instance in $server.ServiceInstances)  
        {  
            if($instance.TypeName -eq $timerServiceInstanceName)  
            {  
                $serverName = $server.Name  
                write-host "Reseting the value of timer cache file in server " $serverName -fore magenta  
                $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config\*-*\cache.ini"  
                Set-Content -path $path -Value "1"  
                write-host "Value of timer cache file in server " $serverName " is resetted to 1" -fore magenta  
                break  
            }  
        }  
    }  
    write-host "The value of timer cache is resetted to 1 in all the SP servers in the farm" -fore green  
    write-host ""  
}
  • Start SharePoint timer service
    Function StartSPTimerServicesInFarm([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-Host ""  
        foreach($server in $farm.Servers)  
            {  
            foreach($instance in $server.ServiceInstances)  
                    {  
                            # If the server has the timer service then stop the service  
                           if($instance.TypeName -eq $timerServiceInstanceName)  
                           {  
                                [string]$serverName = $server.Name  
       
                                Write-Host "Start " $timerServiceName " service on server: " $serverName -fore yellow  
                                   
                                $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                                $serviceInternalName = $service.Name  
                                sc.exe \\$serverName start $serviceInternalName > $null  
      
                                  # Wait until this service starts running  
                      write-host "Waiting for " $timerServiceName " service on server: " $serverName " to be started" -fore yellow  
                                  do  
                          {  
                                  Start-Sleep 1  
                                  Write-Host -foregroundcolor DarkGray -NoNewLine "."  
                                  $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                          }  
                         while ($service.State -ne "Running")  
                     write-host $timerServiceName " service on server: " $serverName " started successfully" -fore green              
                                 break;  
                           }  
                    }  
            }  
       
            Write-Host ""  
    }
  • Complete Code
    $LogTime = Get-Date -Format yyyy-MM-dd_hh-mm  
    $LogFile = ".\ClearSPConfigCachePatch-$LogTime.rtf"  
    # Add SharePoint PowerShell Snapin  
    if ( (Get-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue) -eq $null ) {  
        Add-PSSnapin Microsoft.SharePoint.Powershell  
    }  
    $scriptBase = split-path $SCRIPT:MyInvocation.MyCommand.Path -parent  
    Set-Location $scriptBase  
    #Deleting any .rtf files in the scriptbase location  
    $FindRTFFile = Get-ChildItem $scriptBase\*.* -include *.rtf  
    if($FindRTFFile)  
    {  
        foreach($file in $FindRTFFile)  
            {  
                remove-item $file  
            }  
    }      
    start-transcript $logfile  
    Write-host "##############Following steps will be involved################" -fore green  
    write-host "Step 1 - Stop the timerservice" -fore cyan  
    write-host "Step 2 - Take the backup of config cache file" -fore cyan  
    write-host "Step 3 - Delete the XML files" -fore cyan  
    write-host "Step 4 - Reset the cache.ini file" -fore cyan  
    write-host "Step 5 - Start the SP timerservice" -fore cyan  
    Write-host "##############Above steps will be involved##################" -fore green  
      
    $global:timerServiceName = "SharePoint 2010 Timer"  
    $global:timerServiceInstanceName = "Microsoft SharePoint Foundation Timer"  
   
    # Get the local farm instance  
    [Microsoft.SharePoint.Administration.SPFarm]$farm = [Microsoft.SharePoint.Administration.SPFarm]::get_Local()  
    Function StopSPTimerServicesInFarm([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-Host ""  
        foreach($server in $farm.Servers)  
            {  
            foreach($instance in $server.ServiceInstances)  
                    {  
                            # If the server has the timer service then stop the service  
                           if($instance.TypeName -eq $timerServiceInstanceName)  
                           {  
                                [string]$serverName = $server.Name  
       
                                Write-Host "Stop " $timerServiceName " service on server: " $serverName -fore yellow  
                                   
                                $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                                $serviceInternalName = $service.Name  
                                sc.exe \\$serverName stop $serviceInternalName > $null  
      
                                  # Wait until this service has actually stopped  
                      write-host "Waiting for '$timerServiceName' service on server: " $serverName " to be stopped" -fore yellow  
                                  do  
                          {  
                                  Start-Sleep 1  
                                  Write-Host -foregroundcolor DarkGray -NoNewLine "."  
                                  $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                          }  
                         while ($service.State -ne "Stopped")  
                     write-host " '$timerServiceName' service on server: " $serverName " stopped successfully" -fore green              
                                 break;  
                           }  
                    }  
            }  
       
            Write-Host ""  
    }  
    Function BackupSPConfigFiles([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        write-host ""  
        write-host "Backup SP config cache files" -fore yellow  
          
        foreach($server in $farm.servers)  
        {  
            foreach($instance in $server.ServiceInstances)  
            {  
                if($instance.TypeName -eq $timerServiceInstanceName)  
                {  
                    $ServerName = $server.name  
                    $FolderName  = $servername + "SPConfigCacheBackup"  
                    write-host "Creating a folder to hold the backup files" -fore magenta  
                    write-host "Checking whether the folder aleady exist"  
                    if(Test-path $scriptbase\$FolderName)  
                    {  
                        write-host "Folder already exists and the script is deleting it......"  
                        remove-item $scriptbase\$FolderName -recurse -confirm:$false   
                        write-host "Existing folder deleted" -fore green  
                    }  
                    else  
                    {  
                        write-host "Folder does not exist"  
                    }  
                    New-Item $scriptbase\$FolderName -type directory  
                    write-host "New folder created to hold the backup files" -fore magenta  
                    write-host "Backup of SP config files for the server " $serverName " started ...... " -fore yellow  
                    $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config"  
                    Copy-Item $path -Destination $scriptbase\$FolderName -recurse  
                    write-host "SP config cache files backed up for the server " $serverName " Sucessfully..." -fore green  
                }  
            }  
        }  
        write-host "SP config caches files are backed up" -fore green  
        write-host ""  
    }  
    Function DeletingXMLFiles([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-host ""  
        write-host "Deleting SP config cache XML files from each server in the farm" -fore yellow  
        $path = ""  
        foreach($server in $farm.servers)  
        {  
            foreach($instance in $server.ServiceInstances)  
            {  
                if($instance.TypeName -eq $timerServiceInstanceName)  
                {  
                    $serverName = $server.Name  
                    write-host "Deleting SP config cache files from the server " $servername -fore magenta  
                    $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config\*-*\*.xml"  
                    remove-item -path $path -force  
                    write-host "SP config cache files deleted on the server " $servername -fore magenta  
                    break  
                }  
            }  
        }  
        write-host "SP config cache XML files from each server in the farm is deleted successfully......" -fore green  
        write-host ""  
    }  
    Function ResetTimerCache([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        write-host ""  
        write-host "Reseting the value of timer cache to 1" -fore yellow  
        $path = ""  
        foreach($server in $farm.servers)  
        {  
            foreach($instance in $server.ServiceInstances)  
            {  
                if($instance.TypeName -eq $timerServiceInstanceName)  
                {  
                    $serverName = $server.Name  
                    write-host "Reseting the value of timer cache file in server " $serverName -fore magenta  
                    $path = "\\" + $serverName + "\c$\ProgramData\Microsoft\SharePoint\Config\*-*\cache.ini"  
                    Set-Content -path $path -Value "1"  
                    write-host "Value of timer cache file in server " $serverName " is resetted to 1" -fore magenta  
                    break  
                }  
            }  
        }  
        write-host "The value of timer cache is resetted to 1 in all the SP servers in the farm" -fore green  
        write-host ""  
    }  
    Function StartSPTimerServicesInFarm([Microsoft.SharePoint.Administration.SPFarm]$farm)  
    {  
        Write-Host ""  
        foreach($server in $farm.Servers)  
            {  
            foreach($instance in $server.ServiceInstances)  
                    {  
                            # If the server has the timer service then stop the service  
                           if($instance.TypeName -eq $timerServiceInstanceName)  
                           {  
                                [string]$serverName = $server.Name  
       
                                Write-Host "Start " $timerServiceName " service on server: " $serverName -fore yellow  
                                   
                                $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                                $serviceInternalName = $service.Name  
                                sc.exe \\$serverName start $serviceInternalName > $null  
      
                                  # Wait until this service starts running  
                      write-host "Waiting for " $timerServiceName " service on server: " $serverName " to be started" -fore yellow  
                                  do  
                          {  
                                  Start-Sleep 1  
                                  Write-Host -foregroundcolor DarkGray -NoNewLine "."  
                                  $service = Get-WmiObject -ComputerName $serverName Win32_Service -Filter "DisplayName='$timerServiceName'"  
                          }  
                         while ($service.State -ne "Running")  
                     write-host $timerServiceName " service on server: " $serverName " started successfully" -fore green              
                                 break;  
                           }  
                    }  
            }  
       
            Write-Host ""  
    }         
    #############Calling functions################  
    StopSPTimerServicesInFarm $farm  
    BackupSPConfigFiles $farm  
    DeletingXMLFiles $farm  
    ResetTimerCache $farm  
    StartSPTimerServicesInFarm $farm  
    ##########################################    
    write-host "SCRIPT COMPLETED" -fore cyan  
    stop-transcript

Execution Procedure

  1. Step 1: Download the script and copy it to the SharePoint server.
  2. Step 2: Navigate to the script path.
  3. Step 3: Execute the script.

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

 

 

 

SharePoint 2013 Hosting :: How To Retrieve Followed Sites in SharePoint 2013 Using REST API

This article explains how to retrieve the site name and URL followed by the current user in SharePoint 2013 using a client object model (REST API and JavaScript)

We can use the SharePoint 2013 Representational State Transfer (REST) service to do the same tasks you can do when you use the .NetCSOM, JSOM.
Here I explain how to retrieve the site name and URL followed by the current user in SharePoint 2013 using a client object model (REST API and JavaScript) and displaying it in the SharePoint page.

  • Create a new page and a Content Editor Webpart (CEWP)

Create a New page

  • Edit the web part that was added to the page.
  • Upload your text file script into the site assests and copy the path of the text file and paste it into the Content link in CEWP.

Code

The following example shows how to retrieve all of the following sites:

<html>    
    <head>    
       <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>    
          <script type="text/javascript">  
             var followingManagerEndpoint;  
             var followedCount; 
             var followingEndpoint;    
             var URL;    
             var website;    
             var clientContext;  
             SP.SOD.executeFunc('sp.js', 'SP.ClientContext', loadWebsite);    
             function loadWebsite() {    
                clientContext = SP.ClientContext.get_current();    
                website = clientContext.get_web();    
                clientContext.load(website);    
                clientContext.executeQueryAsync(onRequestSucceeded, onRequestFailed);    
             }    
             function onRequestSucceeded() {   
               URL = website.get_url();    
               followingManagerEndpoint = decodeURIComponent(URL) + "/_api/social.following";   
               getMyFollowedContent();  
            }    
            function onRequestFailed(sender, args) {    
              alert('Error: ' + args.get_message());    
            }   
            // Get the content that the current user is following.  
            // The "types=14" parameter specifies all content types  
            // (documents = 2 + sites = 4 + tags = 8).  
           function getMyFollowedContent() {  
             $.ajax( {  
                  url: followingManagerEndpoint + "/my/followed(types=14)",  
                  headers: {   
                      "accept": "application/json;odata=verbose"  
                  },  
                  success: followedContentRetrieved,  
                  error: requestFailed  
            });  
         }  
         // Parse the JSON data and iterate through the collection.  
         function followedContentRetrieved(data) {  
             var stringData = JSON.stringify(data);  
             var jsonObject = JSON.parse(stringData);   
             var types = {  
               1: "document",  
               2: "site",  
               3: "tag"   
            };  
            var followedActors = jsonObject.d.Followed.results;   
            var followedList = "You're following items:";  
            for (var i = 0; i < followedActors.length; i++) {  
               var actor = followedActors[i];  
               followedList += "<p>The " + types[actor.ActorType] + ": \"" +actor.Name + "\"</p>"+"<p>Site URL " + ": \"" +  
               actor.Uri+ "\"</p>";;  
            }   
            $("#Follow").html(followedList);   
         }  
         function requestFailed(xhr, ajaxOptions, thrownError) {  
           alert('Error:\n' + xhr.status + '\n' + thrownError + '\n' + xhr.responseText);  
         }  
       </script>    
    </head>    
 <body>    
 <div id="Follow"></div>    
 </body>    
 </html>

Happy Coding :)

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com

ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting – ASPHostPortal.com :: SharePoint Workflow Options to Drive Workforce Productivity

These days several organizations still rely on obsolete practices to handle their day to day operations. These approaches have an adverse influence on the workforce productivity in terms of wasted man-hours required to carry out a simple activity. Using the rise in competitors and service industrialization, leading enterprises are looking for techniques to grow to be much more effective in optimizing time for production of goods or solutions that conform to quality norms. These enterprises strive to create automated workflows with state of the art automation technologies to achieve better output.

ahp banner sharepoint-01Even though process automation has been around for some time now, there are not many takers for it as organizations still favor to carry on using the legacy approaches for managing day to day operational activities to save a number of dollars.

How workflow automation assists?

Managing workflows call for effective collaboration amongst workflow participants. Take into account a easy example of an approval approach for updating a set of content material on a internet site, exactly where an employee’s content suggestions are reviewed 1st by his manager after which by the group head followed by the technical head. The employee, the manager, the head, the technical team are participants inside the content material approval workflow. They communicate by means of emails, telephone calls or by manually following up with each other. Besides, you can find a great deal of reminder events that consume plenty of time. This is a simple approach which demands effective coordination among departments and internal teams. To expedite the process one particular requirements to scale up the process and automate it to ensure that when every single workflow participant performs its job, the subsequent participant gets an automatic update quickly. A unified communication platform can go a lengthy way in easing the method. In this example, after the content material has been authorized by the manager, an alert will likely be sent for the head for the next round of review followed by the technical head’s overview. Similarly, there are a large number of processes that run across organizations and communicating by means of emails and phone calls become tedious and time consuming.

SharePoint workflows to help your company operations

SharePoint workflow solutions assist organizations by automating manual processes and aid workflow participants grow to be a lot more efficient and productive when functioning with documents, types and libraries in SharePoint. Making use of SharePoint, an employee can start a workflow on a document and simply achieve his task. SharePoint facilitates automated workflows across various operational scenarios. A few of these scenarios are collecting feedback, collecting digital signatures, document translations and group approval processes. These workflow solutions can assist organisations save man-hours and effectively utilize their resources.

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com
ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability

SharePoint 2013 Hosting – ASPHostPortal.com :: Example for Simple CRM and SharePoint Integration

Throughout the Swedish SharePoint and Exchange Forum 2006 held just outdoors Stockholm on Rosenön this spring, I showed how to make a basic integration of MS CRM and MS SharePoint 2003.

Both technologies are very versatile and are easily integrated with other software, mainly on account of the helpful webservices which can be obtainable.

ahp banner sharepoint-01
The integration I created was to automatically produce a workspace when a new account was developed. The following measures describe how this was produced attainable:

  1. Create a site in SharePoint that will contain all subsites.
  2. Create a new attribute in CRM, nvarchar 255 that will contain the SharePoint site URL.
  3. Create an IFrame in CRM. Modify the onload JavaScript in CRM to set the src of the IFrame to the SharePoint site URL (if it is not null).
  4. Create a dll that creates the SharePoint site and return the new sites URL and can be called on by a CRM workflow.
  5. Modify the workflow.config to add the functionality to the workflow manager.
  6. Create the workflow triggered by Create on account that creates the site and return the URL. Set the new SharePoint-site-url attribute to the return value of the function.

This integration is great, and it is also achievable to create a far more enhanced handling by using the PreCreate Callout instead of utilizing the workflow. However, the workflow-addon designed may be constructed to become quite generic and may hence be utilized for other purposes at the same time, (as an illustration making a SharePoint website for every Opportunity).

I’ll base the SharePoint-site-name around the accountname attribute that is not guaranteed to be special. Within this example I will not go through how to make a duplet checking plan, which need to also be produced, in the event the websites should be depending on accountname. The sitename could also be depending on the account GUID which is assured to be unique.

I will now go through each from the six points in much more detail:

  1. Produce a SharePoint web site that may include all subsites
    Just make use of the regular SharePoint interface, choose generate from the prime menu and then pick site, nearly at the bottom on the list, no distinct template is needed. Note the url to the newly developed website.
  2. Generate a new attribute for the SharePoint web site url
    In CRM, select settings, customizations, customize entitys, account, attributes, create. Create a new attribute called as an illustration “new_spsiteurl” as nvarchar and length 255 (255 must be sufficient for anyone :).
  3. Generate an IFrame in CRM
    Now pick types and views in CRM. Select type. You must now see the editable version on the account form. Click “New Tab” within the appropriate hand menu. Name the new tab “SP Site” or something acceptable. The tab must now be visible.

Choose the “SP Site” tab then pick “Create section” from the right hand menu. Get in touch with it anything good. Also choose to not show the name in the section.

In the new section, select “Add field”. Choose the newly created attribute, “new_spsiteurl”. Verify the checkbox for read-only. Click OK.

Now choose “Create IFrame” from the proper hand menu. Produce an IFrame within the section designed above. Check the checkbox in formatting that makes it fill the form. Get in touch with the IFrame one thing like “IFRAME_spframe”. Click ok to make.

Click the “Form Properties” inside the right hand menu in the bottom. Edit the onLoad script. Place within the following script:

If (crmForm.all.new_spsiteurl.DataValue != null)
{
crmForm.all.IFRAME_spframe.src = crmForm.all.new_spsiteurl.DataValue;
}

Close the dialogs. Click save and close on all forms. When you are back to the main CRM-window, select account in the entities list and click “publish”.

Produce the workflow addon dll

Open Visual Studio 2003 (it will operate with VS 2005 also, however, if you’d like to do this with callouts, you may have to comply with the instruction concerning callout improvement in VS 2005 that I have blogged about earlier, with reference to Arash weblog).

Develop a brand new standard C# project having a straightforward class-file. Name the project some thing like “WFAddons”. Rename the cs-file something like “WFAddons”, be sure that the code is coherent with the naming of the file to avoid any confusions.

Make sure you might have a reference to the SharePoint-dll.

With each of the code to create the SharePointsite, the file ought to appear some thing like this:

using System;
using Microsoft.SharePoint;

namespace WFAddons
{
public class WFAddons
{

public string CreateWorkSpace(string accountname)
{
SPSite siteCollection = new SPSite("http://localhost/sites/konton");
SPWebCollection subSites = siteCollection.AllWebs;

SPWeb mySite = subSites.Add(accountname);
mySite.Title = accountname;
mySite.Name = accountname;
mySite.Update();
return mySite.Url;
}
}
}

Inside the row: SPSite siteCollection = new SPSite(“http://localhost/websites/Micah”);
Modify the url to match the web site created in step 1.

Now set the output directory for the CRM-assembly folder. This is usually located right here:
c:\Program Files\Microsoft CRM\Server\bin\assembly\ but is dependant around the CRM-installation.

Compile the project.

Modify workflow.config

Within the folder: c:\Program Files\Microsoft CRM\Server\bin\assembly\, open the file workflow.config and before the finish tags

(
</methods>
</workflow.config>
)

add the following:

<method name="Create workspace"
assembly="WFAddons.dll"
typename="WFAddons.WFAddons"
methodname="CreateWorkSpace"
group="SharePoint functions">
<parameter name="accountname" datatype="string"/>
<result datatype="string"/>
</method>

Generate the workflow

Now, all you might have to do is generate the workflow that can run all this and tie every little thing with each other. Open the workflow manager, select account, and generate a brand new workflow that will be triggered on create. Within the editor, pick “Insert Action” and choose “Call assembly” choose the group name (exactly the same set in workflow.config above), and also the pick the strategy name. Inside the new dialog window, double-click the parameter (the name set in workflow.config) and pick dynamic worth and select the entity Account and decide on the attribute accountname. Inside the primary action dialog, a youcan now see this mapping. Enter an action name, like “create workspace”. Click “Save”.

Best Recommended SharePoint 2013 Hosting

ASPHostPortal.com
ASPHostPortal.com is Perfect, suitable hosting plan for a starter in SharePoint. ASPHostPortal  the leading provider of Windows hosting and affordable SharePoint Hosting. ASPHostPortal proudly working to help grow the backbone of the Internet, the millions of individuals, families, micro-businesses, small business, and fledgling online businesses. ASPHostPortal has ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2015, .NET 5/ASP.NET 4.5.2, ASP.NET MVC 6.0/5.2, Silverlight 6 and Visual Studio Lightswitch, ASPHostPortal guarantees the highest quality product, top security, and unshakeable reliability, carefully chose high-quality servers, networking, and infrastructure equipment to ensure the utmost reliability