Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

February 2015

Incoming Email 2007 to 2013 Upgrade – Errors occurred processing message

After upgrading from SharePoint 2007 to 2013, I experienced a problem with receiving incoming emails on migrated sites from SP 2007.    ULS logs showed incoming email attempting to process EML files but then quickly failing with “Message ID:” but not the EML file name or alias.   After extensive testing we found that SPSite objects were “locked” for exceeding Sandbox Resource Points.   Toggling the “BitFlags” value allowed us to clear the “Resource Exceeded” and allow incoming email to process.

Also, we disabled a few Timer Jobs which calculate Sandbox Resource points (and were re-establishing the SPSite lock).    With both BitFlags cleared to “0” and timer jobs disabled everything ran smoothly.

 

ULS Failure

02/17/2015 16:46:12.69    OWSTIMER.EXE (0x0C54)    0x1C4C    SharePoint Foundation    E-Mail    6871    Information    The Incoming E-Mail service has completed a batch.  The elapsed time was 00:00:00.  The service processed 2 message(s) in total.  Errors occurred processing 2 message(s): Message ID:  Message ID:   

 

BitFlag.ps1

param($bitflag)
# Test input number and display full composition (each true/false flag)
$bitflag
(1..50) |% {$test = [Math]::Pow(2, $_); $found=($test -band $bitflag); 1 | select {$test},{$found}}

 

[AllSites].[dbo].[BitFlags]  Composition

Table   [AllSites]
Column  [BitFlags]

Failed Site have Decimal Value:      12582912
Failed Site have Hexadecimal Value:  0xC00000

V_SF_RESOURCEMAXSENT
V_SF_RESOURCEMAXLOCK

Details:
                      V_SF_WRITELOCK  0000000000000001    00000000000000000001     no
                       V_SF_READLOCK  0000000000000002    00000000000000000002     no
                 V_SF_FOUNDATIONLOCK  0000000000000004    00000000000000000004     no
                       V_SF_DISKLOCK  0000000000000008    00000000000000000008     no
                         V_SF_BWLOCK  0000000000000010    00000000000000000016     no
                 V_SF_NONPAYMENTLOCK  0000000000000020    00000000000000000032     no
                  V_SF_VIOLATIONLOCK  0000000000000040    00000000000000000064     no
                V_SF_DISKLOCKMSGSENT  0000000000000080    00000000000000000128     no
                  V_SF_BWLOCKMSGSENT  0000000000000100    00000000000000000256     no
                V_SF_USERLOCKMSGSENT  0000000000000200    00000000000000000512     no
                V_SF_DISKWARNINGSENT  0000000000000400    00000000000000001024     no
                  V_SF_BWWARNINGSENT  0000000000000800    00000000000000002048     no
                      V_SF_LARGESITE  0000000000001000    00000000000000004096     no
              V_SF_MAYHAVESITEALERTS  0000000000008000    00000000000000032768     no
                   V_SF_TRIMAUDITLOG  0000000000010000    00000000000000065536     no
                   V_SF_READONLYLOCK  0000000000020000    00000000000000131072     no
                     V_SF_PRESCANNED  0000000000040000    00000000000000262144     no
         V_SF_USERACCOUNTRESTRICTION  0000000000080000    00000000000000524288     no
          V_SF_USERSOLUTIONACTIVATED  0000000000100000    00000000000001048576     no
               V_SF_RESOURCEWARNSENT  0000000000200000    00000000000002097152     no
                V_SF_RESOURCEMAXSENT  0000000000400000    00000000000004194304    yes
                V_SF_RESOURCEMAXLOCK  0000000000800000    00000000000008388608    yes

V_SF_HASSITESCOPEDUSERCUSTOMACTIONS  0000000001000000    00000000000016777216     no
  V_SF_UIVERSIONCONFIGURATIONENABLED  0000000002000000    00000000000033554432     no
             V_SF_SHAREBYLINKENABLED  0000000004000000    00000000000067108864     no
   V_SF_USERDEFINEDWORKFLOWSDISABLED  0000000010000000    00000000000268435456     no
   V_SF_HTTPSHOSTHEADERSITEURLSCHEME  0000000020000000    00000000000536870912     no
                         V_SF_UNUSED  0000000040000000    00000000001073741824     no
            V_SF_SHAREBYEMAILENABLED  0000000080000000    00000000002147483648     no

 

Disabled Timer Jobs

  • Solution Daily Resource Usage Update
  • Solution Resource Usage Log Processing
  • Solution Resource Usage Update

NOTE – All 3 timer job definitions above repeat per web application.   In our case, we disabled 6 = 3 jobs X 2 web apps.

get-sptimerjob |? {$_.name -eq "job-solution-daily-resource-usage" -or 
$_.name -eq "job-solution-resource-usage-update" -or 
$_.name -eq "job-solution-resource-usage-log"}
 | select name,displayname,IsDisabled,LastRunTime,schedule

Reference

SAAM – Site Asset App Model

Developers have more options in SharePoint 2013 than any version before.   App Model is center stage.  Understandably this has created some confusion and debate in the community.   I’d like to suggest another coding pattern to consider in addition to pure App Model which I call “Site Asset App Model.”

Long before SP2013 released, I would add jQuery “widgets” to pages in MOSS2007 and SP2010 with a Content Editor.  Upload HTML, CSS, and JS files.  Simple and effective.   Requires no special infrastructure changes.  This approach remains valid and has actually improved with advancements like :

  • JavaScript frameworks
  • Angular,  Knockout
  • HTML 5 browsers
  • REST /_api/ endpoints
  • ASP.Net WebAPI
  • Entity Framework
  • BreezeJS

I might not always use pure “App Model”, but I’m 100% sold on JavaScript front end development and the “from Bricks to Houses” philosophy (http://channel9.msdn.com/Events/SharePoint-Conference/2014/SPC404)    Call this whatever name you like, but JavaScript coding has advantages for both developers and administrators alike.    I suggest coding JS first, then fallback to C# wrapped in WebAPI over HTTP, and finally farm solution WSP as last resort.  

Please leave a comment if you found this helpful!  

shades_smile

Diagram

image
image

How to Use

Configure

  • Create new folder in Site Assets
  • Map drive letter
  • Create HTML/JS/CSS files with local IDE (Visual Studio, Brackets, NotePad++, etc.)
  • Add page to SharePoint site
  • Add Content Editor to page. Set source Property to HTML location.

Debug

  • Edit source HTML/JS/JSS
  • Reload with browser
  • Press F12 to debug, set breakpoints, inspect DOM
  • NOTE – adding the JS statement “debugger;” can help raise a local browser event. That can be a nice trick to more easily create breakpoints in your editor instead of scrolling the same codebase again with F12. http://www.w3schools.com/js/js_debugging.asp

Admittedly there are drawbacks:

  • No Visual Studio F5 debug
  • No full package (.APP)
  • No Office365 store
  • No app-only principal (limited to current user permissions)
  • Hard to deploy multiple instances

However, there might be times when SAAM is preferred:

  • Working on SP2007/2010
  • Lacking SP2013 App Model infrastructure (Wildcard DNS, Service Apps, etc.)
  • Visual Studio not available (required for .APP package/deploy)
  • Non-SharePoint developers comfortable editing HTML/JS/CSS directly

Comparison Table

FeatureSP2013
“App Model”
Site Assets
App Model
(SAAM)
HTTP call host web without SP Request Executor ProxyNOYES
Support REST to External Content Types made in SharePoint DesignerNOYES
List and Library user data kept if app uninstalled (code upgrade)NOYES
Create standard Views for lists and libraries with App user dataNOYES
Works on SP2007 and 2010 older versionsNOYES
Restricted to “App Web” where many features disabledYESNO
Requires server infrastructure changesYESNO
* Claims authenticationYESNO
* Wildcard DNS on networkYESNO
* Service ApplicationsYESNO
* Additional SQL databases and service accountsYESNO
Requires security manifestYESNO
* Permissions plan to useYESNO
* Web service endpoint URLsYESNO
Able to publish and sell in Office 365 StoreYESNO
Able to use App Identity Security PrincipalYESNO

SP2013 “App Model”

Site Assets App Model (SAAM)

straight-jacket-costume

References

http://channel9.msdn.com/Events/Speakers/Scot-Hillier

  • ​”From bricks to houses” > wider view beyond “App Model” looking at all front end coding (JS/REST)

http://www.itunity.com/community/questions/view/question/id/1

  • ​Use SharePoint where it makes sense (components ready), but now able to include a wider menu of 3rd party technology choices.  
  • Non-Microsoft, Google, others, and a whole web of innovation beyond SP core.

http://blogs.msdn.com/b/amigan/archive/2012/12/10/part-2-introduction-to-sharepoint-2013-app-model.aspx

  • Detailed comparison table
  • Yes, some things cannot be done in “App Model”
  • Yes, farm solutions are still valid  (but as a last resort – try front end coding first)

http://sharepointpromag.com/blog/sharepoint-2013-s-cloud-app-model-it-s-what-you-wanted-all-along

  • ​And ultimately, it’s going to be moot. In multi-tenant environments such as Office 365, this is the only real option.
  • Office365 is the gold standard for low administrative effort.

InfoPath – search replace URLs within XSN

Need to migrate forms to another URL?   But not sure how to update many data connections?  Try the script below.

This PowerShell will extract XSN contents to a folder, execute string search replace, and “package” back into CAB format with XSN extension.   A simple way to migrate InfoPath forms to another DNS name for scenarios like AAM Alternate Access Mapping redirection and SharePoint major version upgrade (2007 > 2010 > 2013).

Enjoy! 

shades_smile

 

NOTE – Requires CABARC.EXE  http://stackoverflow.com/questions/3361928/where-can-i-get-the-cabarc-utility

 

InfoPath_UpdateDataConnetions.ps1

# Update InfoPath form URLs by extracting CAB and performing search replace
Param(
	[string]$xsnFile
)
Write-Host "Prepare folders..."
md c:\InfoPath\before
md c:\InfoPath\temp
md c:\InfoPath\after
Write-Host "Clean temp..."
Remove-ChildItem c:\InfoPath\temp\*.* -Recurse
Write-Host "Extract XSN... $xsnFile"
cabarc x "c:\InfoPath\before\$xsnFile" *.* c:\InfoPath\temp\
Write-Host "Replace URL..."
$txt = Get-Content c:\InfoPath\temp\Manifest.xsf
$txt |% {$_ -replace "//sharepoint/" "//sharepnt07/"} | Out-File -FilePath "c:\InfoPath\temp\Manifest.xsf" -Encoding UTF8 -Force
Write-Host "package XSN..."
cabarc n "c:\InfoPath\after\$xsnFile" c:\InfoPath\temp\*.*
Write-Host "DONE"

 

Knee Cap MDS (disable for new and current sites)

Disable Minimal Download Strategy in SharePoint 2013.  This will update the current farm “MDSFeature” XML to disable for all newly created site collections and child webs.   If you need to support IE8 and older browsers this can be helpful.  The feature GUID technically remains active but won’t do anything.  After desktops upgrade (IE11/Win8) then this change can be reversed with a simple file copy “ORIG” back to “XML.”     Hope this helps!   

Smile

 

PowerShell – Disable MDS

# run once per farm
# unregister Feature definition from ConfigDB
Uninstall-SPFeature MDSFeature -Force -Confirm:$false
# backup current Feature XML
$path = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\MDSFeature\feature.xml"
Copy-Item $path "$path-orig"
# modify Feature XML to suppress DLL assembly detail  (still registered, but unable to run)
 $x = Get-Content $path
$x.Feature.RemoveAttribute("ReceiverClass")
$x.Feature.RemoveAttribute("ReceiverAssembly")
$x.Save($path)
# register Feature to ConfigDB
Install-SPFeature MDSFeature

 

PowerShell – Enable MDS

# run once per farm
# unregister Feature definition from ConfigDB
Uninstall-SPFeature MDSFeature -Force -Confirm:$false
# backup current Feature XML
$path = "C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\TEMPLATE\FEATURES\MDSFeature\feature.xml"
Copy-Item "$path-orig" $path -Force -Confirm:$false
# register Feature to ConfigDB
Install-SPFeature MDSFeature

 

I looked at many options but none were are simple as the above “knee cap” to simply void the DLL reference and keep the feature GUID active but with no functional user impact.   So if you must support SP2013 on IE8 give the above a try.

  • Task Scheduler job to run “Disable-SPFeature” on a regular basis
  • Manually ask users to disable (hard to do if you can’t navigate Site Settings)
  • Feature Stapling – MDS doesn’t use stapling and I couldn’t find any reference beyond “MDSFeature\feature.xml”
  • Uninstall SPFeature  (then get error – can’t create sites/webs)

 

 

References

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲