Showing posts with label SharePoint 2010. Show all posts
Showing posts with label SharePoint 2010. Show all posts

Tuesday, December 6, 2016

Find things in InfoPath form templates in a web application

This assessment and clean up process to get things ready for SharePoint online migration is pretty interesting.   So there are some custom web services created for InfoPath forms so that it can get data and functions (lots of date functions) that is not available out of the box.   So need to find all the published templates with the calls to these web services.

So after thinking about what can be done with code and reviewing the InfoPath interop classes leading nowhere.   I found an interesting article https://sharepintblog.com/2011/06/07/updating-infopath-form-templates-and-data-connections-with-powershell/

so with the code that they provided, i modified it to spit out all templates with the data connections to these web services.  

Hope this helps since it is saving a lot of time and effort to track these down and find a workaround.

--updated with the code to include list templates not just document libraries. 

Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue

## the web application to be searched for form libraries
$url = 'https://yoursharepointurl'

## temp working directory
$dir = 'D:\ExtractedForms'


$findstring = 'findthis String'

$exportFile = $false

foreach ($web in (Get-SPWebApplication $url | Get-SPSite -Limit All| Get-SPWeb -Limit All))
{
    foreach($list in $web.Lists)
    { 
        if ($list.DocumentTemplateUrl -ne $null -or $list.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"])
        {
            if ($list.ContentTypes[0].ResourceFolder.Properties["_ipfs_infopathenabled"])
            {
                #--------------- get the templateurl for the list template....  
                foreach($folder in $list.RootFolder.SubFolders)
                {
                    foreach($file in $folder.Files)
                    {
                        if($file.Name -eq 'template.xsn')
                        {
                            $listUrl = $web.Url + '/' + $list.RootFolder + '/' + $folder.Name
                            $templateUrl = $web.Url + '/' + $list.RootFolder + '/' + $folder.Name +'/template.xsn'

                            $exportFile = $true 
                        }
                    }               
                }             
                                          
            }
            elseif ($list.DocumentTemplateUrl.ToString().ToLower().EndsWith(".xsn"))
            {
                $listUrl = $web.Url + '/' + $list.rootFolder
                $templateUrl = $web.Url + '/' + $list.DocumentTemplateUrl

                $exportFile = $true 
            }

            if($exportFile)
            {
                ## download the form template
                $filename = $file.Name
                $fileID = $file.UniqueId.Tostring()
                $localfile = $fileID + "\" + $filename

                $file = $web.GetFile($templateUrl)
                $bytes = $file.OpenBinary();

                # Download the file to the path
                $localfile = $dir + "\" + $localfile
                New-Item "$dir\$fileID" -type directory -force | Out-Null
                New-Item "$dir\$fileID\Extracted" -type directory -force | Out-Null
                [System.IO.FileStream] $fs = New-Object System.IO.FileStream($localfile, "OpenOrCreate")
                $fs.Write($bytes, 0 , $bytes.Length)
                $fs.Close()
            
                ## crack open the form template
                EXPAND "$localfile" -F:* "$dir\$fileID\Extracted" | Out-Null
                
                ## get file content and check for string
                $extractedFiles = Get-ChildItem "$dir\$fileID\Extracted" *.x*
                foreach ($extractedFile in $extractedFiles)
                {
                    $efn = $extractedFile.Name
                    $f = [System.IO.File]::Open("$dir\$fileID\Extracted\$efn" ,"open","read","Read")
                    $sr = New-Object System.IO.StreamReader $f
                    $content = $sr.ReadToEnd()
                    $sr.close()
                    $f.close()                     
                     
                    if ($content.Contains($findstring))
                    {
                        Write-Host $templateUrl " :  " $extractedFile.Name -foreground green
                    }
                }               
            }
            $exportFile = $false
        }
    }
    $web.Dispose()

}

Monday, December 5, 2016

Find custom action or activity in a designer created 2010 workflow

While cleaning up my SharePoint farm for the cloud migration, i ran into an interesting problem.   If there are custom activity or action created for your designer workflow, how do you track down which ones uses those custom action or activity.

Here is a simple code to go through a site collection that returns all 2010 workflows that is using your custom action/activity that you created with code.

Add-PSSnapin *sharepoint* -ErrorAction SilentlyContinue

$encode = New-Object System.Text.ASCIIEncoding

$site = get-spsite "type in url"

foreach($w in $site.allwebs)
{
    foreach($wf in $w.Lists["workflows"].items)
    {
        if($wf.Name -like "*.xoml")
        {
            $file   = $wf.File
            $data   = $file.OpenBinary()
          
            $test   = $encode.GetString($data)
            if($test.Contains("text to find.  usually the namespace of the assembly of custom dll") -or $test.Contains("more text"))
            {
                  write-host $w.url $wf.Name
            }
        }
    }


Thursday, September 1, 2016

Report Builder: Unable to install this application

When you encounter an error trying to edit your report and the error states that you can not install the REPORTBUILDER:


/_vti_bin/ReportBuilder/ReportBuilder_3_0_0_0.application?ReportPath=


System.Deployment.Application.DeploymentException (Subscription)
  - Unable to install this application because an application with the same identity is already installed. To install this application, either modify the manifest version for this application or uninstall the preexisting application.
  - Source: System.Deployment
  - Stack trace:
   at System.Deployment.Application.SubscriptionStore.CheckApplicationPayload(CommitApplicationParams commitParams)
   at System.Deployment.Application.SubscriptionStore.CommitApplication(SubscriptionState& subState, CommitApplicationParams commitParams)
   at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
   at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
   at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)


---------------------------------------


Solution is to rather then change the config or manifest file.   Delete the Clickonce application files on your desktop or machine that you are working on located:


%userprofile%\AppData\Local\Apps\2.0\XXXXX.xxx\YYYYYYYY.YYY\*.*


Here is the example of the folders/files that you need to delete.  the command line is as follows:


del C:\Users\masteroftheUniverse\AppData\Local\Apps\2.0\TN076DJP.QJ2\TDNJXD8N.KQ1\*.*


then try to edit the report again, no issues.





Tuesday, September 9, 2014

SharePoint Error in people picker in Infopath filler for SSL termination at F5 rather than at the web application/IIS level

The error occurs in the InfoPath filler people picker:  calls fails /_vti_bin/spclaimproviderwebservice.https.svc


when the SSL termination is done at the F5. 


To resolve, you'll need to create a iRule in F5 or in IIS to strip of the .https for the following two services:


spclaimproviderwebservice.https.svc
and
cellstorage.https.svc

IIS:

<rule name="SpClaimProviderWebService" stopProcessing="true">
<match url="^(.*)spclaimproviderwebservice.https.svc$" />
<action type="Rewrite" url="{R:1}spclaimproviderwebservice.svc" />
</rule>


<rule name="cellStorage" stopProcessing="true">
<match url="^(.*)cellstorage.https.svc$" />
<action type="Rewrite" url="{R:1}cellstorage.https.svc" />
</rule>


F5:


when HTTP_REQUEST {
if { [[string tolower] [HTTP::path]] contains "spclaimproviderwebservice.https.svc"} {
HTTP::path [string map {.https ""} [HTTP::path]]
}
}
when HTTP_REQUEST {
if { [[string tolower] [HTTP::path]] contains "cellstorage.https.svc"} {
HTTP::path [string map {.https ""} [HTTP::path]]
}
}

Wednesday, June 25, 2014

SharePoint 2010 Custom Workflow Actions in SharePoint 2013

After upgrading the error comes up that the action can not load the class.  

Error:  Could not deserialize object. The type 'MyCustom.WorkflowActions.StartAworkflowOnAnotherList' could not be resolved.

Before in 2010:

<System.Workflow.ComponentModel.WorkflowCompiler>
    <authorizedTypes>
          <authorizedType .....>

In SharePoint 2013 after the upgrade which causes this break:

<System.Workflow.ComponentModel.WorkflowCompiler>
    <authorizedTypes>
      <targetFx version="v4.0">
      </targetFx>
       <authorizedType Assembly="MyCustom.WorkflowActions.StartAworkflowOnAnotherList.....>


To fix:

<System.Workflow.ComponentModel.WorkflowCompiler>
    <authorizedTypes>
      <targetFx version="v4.0">
            <authorizedType Assembly="MyCustom.WorkflowActions.StartAworkflowOnAnotherList.....>
      </targetFx>
       

Thursday, February 20, 2014

SharePoint 2010 and SCOM 2012 R2 with APM starts csc.exe instances which overloads the server resources. SCOM 2012 R2 with APM errors with .NET 2.0

The WFE servers resources get overloaded or maxed out with instances of csc.exe running when a site is called.  No real errors are displayed in the event viewer.
Pages do not get loaded due to time outs with the memory and the processors being maxed out.

To resolved till they fix SCOM 2012 R2 APM issues with .NET 2.0, you will need to uninstall from all programs the Microsoft Monitoring and reboot.  Or revert back to SCOM 2012 SP1 agent.

Then all sites are back to normal.