Event ID 6398

Also here: Event ID 6398 (microsoft.com)

The Execute method of job definition Microsoft.SharePoint.Administration.SPAppStateQueryJobDefinition (ID e7ddc5b6-3089-4108-a8ed-4adc453c7c60) threw an exception. More information is included below.
One or more app state queries have failed.
What can I do to fix this also this is for sharepoint 2013 Foundation or whatever the free version is called

Answer:

Go to the SharePoint Central Administration
Click Monitoring
Then click Review job definitions in the Timer Jobs section
Find the Job that is causing the exception by hovering over the links and checking the GUID in there
Click the job and click Disable

SharePoint 2013 not hiding Fields

 

After a SharePoiint Foundation 2010 to SharePoint Foundation 2013 upgrade, hidden fields were showing up again UNTIL the JavaScript line was added into the Edit Page via SharePoint Designer 2013.

<asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
<script type="text/javascript" src="/sites/lng/Style%20Library/jquery/jquery-3.6.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("nobr:contains('Project Registration Date')").closest('tr').hide();
$("nobr:contains('Drawing Review Date')").closest('tr').hide();
$("nobr:contains('Design Contractor')").closest('tr').hide();
$("nobr:contains('Project Initiation Date')").closest('tr').hide();
$("nobr:contains('Installed By')").closest('tr').hide();
$("nobr:contains('Cat.')").closest('tr').hide();
$("input[title*='B defs. (Initial)']").closest('tr').hide();
$("input[title*='B defs. (Remaining)']").closest('tr').hide();
$("input[title*='A defs. (Initial)']").closest('tr').hide();
$("input[title*='A defs. (Remaining)']").closest('tr').hide();
$("nobr:contains('C.R.s')").closest('tr').hide();
});
</script>

 

 

SharePoint 2013 Calculated Column

I just migrated a SharePoint side from 2010 Foundation to SharePoint 2013 Foundation and discovered that the most important column in my Libraries was no longer rendering the HTML it needed. Instead, it was just displaying the HTML. It should be displaying an image in the 15 Hive based on the Date Today and the Report Status. I discovered that Calculated Columns were now disabled by default in SharePoint 2013 and up and that I had to disable this by default. Using the PowerShell below I was able to disable it, however it still would not render the image. I then discoved that the Calculated Column MUST be a Number Data Type and NOT a Single Line of Text that it was in SharePoint 2010.

Just to add to the pain, I was using the Today trick for a column that is referenced in the formula. This is where you create a column that defaults to Today's Date, apply the formula and then delete the Today Column. I accomplished this using some PowerShell and at the same time changed the Data Type to a Number.

Switch if OFF - The Calculated Column Must be a Number output type
$webApp = Get-SPWebApplication https://mySPSite.com
$webApp.CustomMarkupInCalculatedFieldDisabled = $false
$webApp.Update()
Script for updating the Calculated column to a Number Data Type and with the Today Column Added and Deleted after the formula was updated.
if($doesTodayFieldExist -eq $false)
{	
	Write-Host "Creating Today Field" -ForegroundColor DarkBlue
	$dateTimeFieldType = [Microsoft.SharePoint.SPFieldType]::DateTime
	$fieldName = $list.Fields.Add("Today", $dateTimeFieldType, $false)
	$list.Fields[$fieldName].DefaultValue = "[Today]"
	Write-Host "Updating List"  -ForegroundColor DarkBlue
	$list.Update()
}

$field = $list.Fields["Status"]
if($field.Title -eq "Status" -and $field.Type -eq "Calculated")
{ 
	Write-Host "Updating Calculated Column" -ForegroundColor DarkBlue
	$field.Formula = "=Formula Goes here!"

	# For SharePoint 2013 and up this must be a number field
	$field.OutputType = [Microsoft.SharePoint.SPFieldType]::Number
	Write-Host "Updating Field" -ForegroundColor DarkBlue
	$field.Update()
	Write-host "Updating List" -ForegroundColor DarkBlue
	$list.Update()
}			

$field = $list.Fields["Today"]
if($field -ne $null)
{
	Write-host "Deleting Today Field" -ForegroundColor DarkBlue
	$field.Delete()	
	Write-host "Updating List" -ForegroundColor DarkBlue
	$list.Update()
}

SharePoint Custom Pop-up not posting back after first attempt.

This change was required for the SharePoint 2013 Upgrade (from SharePoint 2010), otherwise the page would only post back once and needed to be closed and re-opened to resubmit updates. The change was in private Control RenderHeaderBar()

var header2 = new HtmlGenericControl("h4");

string text2 = "Report ID:" + InspectionReportId + " GUID:" + InspectionReportGuid;

header2.InnerText = text2;

headerBox.Controls.Add(header2);

SharePoint 2013 images folder

Just as an FYI when moving from sharePoint 2010 to SharePoint 2013. The images folder is now accessed via _layouts/15/images. SharePoint 2010 was just _layouts/images!

Since the move to SharePoint 2013 requires that every reference to the “Hive” be prefixed with 15, and 16 for SharePoint 2016 etc, I have moved all logos and references to images to reference the images in the Style Library of each Site collection so that they will not break with consequent upgrades.

SharePoint 2013 Server Search status stuck on “Starting”

This was the fix.

  1. Open SharePoint PowerShell as Administrator
  2. Run this Get-SPServiceInstance -All > Get-SPServiceInstance.txt
    1. It will export all Services to the text file un C:\Users\[Username]\ Get-SPServiceInstance.txt
  3. Find the GUID for the Search Service. It was c0220b13-8093-4240-91e4-8427a68e8c0c
  4. Run the following 3 commands
  5. $value = Get-SPServiceInstance -Identity c0220b13-8093-4240-91e4-8427a68e8c0c
  6. $value.provision()
  7. $value.update()
  8. Reboot the SharePoint Server.
  9. Check that the Incremental Search has started!

SharePoint 2013 | Approve a list item | PowerShell

From here: https://sharepoint-learners.blogspot.com/2016/09/sharepoint-2013-approve-list-item.html

Work Statement: Approve all the list items
 
$site = new-object Microsoft.SharePoint.SPSite("http://site")
$web = $site.OpenWeb()
$list = $web.Lists["Posts"]
$items = $list.Items

foreach ($item in $items)
{
    $item["_ModerationStatus"] = 0
    $item.Update()
}



Work Statement: You want to approve a single list item

$site = new-object Microsoft.SharePoint.SPSite("http://site")
$web = $site.OpenWeb()
$list = $web.Lists["Posts"]
$items = $list.GetItemById(10)
$item["_ModerationStatus"] = 0

$item.Update()


The following are more ModertionStatus:

ValueDescription
0 The list item is approved.
1 The list item has been denied approval.
2 The list item is pending approval.
3 The list item is in the draft or checked out state.
4 The list item is scheduled for automatic approval at a future date.

SharePoint 2013 Data-View Web Part that Filters on Multiple Lines of Text Columns

QUESTION:

We are using the Bamboo Data-View Web Part in SharePoint 2013 to allow users to filter and export results from a single Library and I have just discovered that the Filter is hidden in a column when you have a Multiple Lines of Text in the grid. This makes the tool pretty useless now so I was hoping that someone has come across a better Web Part?

ANSWER:

So the answer is that Multi-line Text fields in SharePoint are NOT searchable or Filterable, end of story. I have found a solution that works. This solution is to keep a SQL Server table update to date with the library data, less the documents of course, and use a nvarchar(4000) column for the multi-line text fields. We will never exceed that number of characters so this works great plus it's much faster than rendering a SharePoint Library!