- Home
- Blog
Blog
On 16/11/2018
Sharepoint caml query errors
The following exception occurred while trying to enumerate the collection: "Un ou plusieurs types de champs ne sont pas installés correctement. Accédez à la page des paramètres de liste pour supprimer ces champs.
i think my list was corrupted, but it was only my query who's got mistakes
if you see error above, try your query only with <Where></Where>, if she's working, your query contains errors
On 16/11/2018
param(
[string]$siteCollUrl = "http://test/sites/site1/", [string]$listTitle = "Stockage",
[boolean]$checkin = $false, [boolean]$publish = $false, [boolean]$deleteAllVersion = $true
)
$web = Get-SPWeb $siteCollUrl
$splList = $web.Lists[$listTitle]
$spqQuery = New-Object Microsoft.SharePoint.SPQuery
$spqQuery.Query = "1 ";
$spqQuery.ViewAttributes = "Scope=""RecursiveAll""";
$spqQuery.ViewFields = " " #_UIVersionString
$spqQuery.ViewFieldsOnly = $true
$spqQuery.RowLimit = 1000;
# IsCheckedoutToLocal
$iNumber = 1
do {
if ($iNumber -eq 1) {
$spqQuery.ListItemCollectionPosition = $splListItems.ListItemCollectionPosition;
}
$splListItems = $splList.GetItems($spqQuery)
writeInfo "page number : $($iNumber)"
foreach ($splListItem in $splListItems) {
writeInfo "web $($web.ServerRelativeUrl) splList $($splList.RootFolder.ServerRelativeUrl) File id : $($splListItem.Id) # $($splListItem.Name) Title: $($splListItem["Title"]) Version: $($splListItem["owshiddenversion"]) _Level: $($splListItem["_Level"]) _IsCurrentVersion: $($splListItem["_IsCurrentVersion"]) _UIVersion: $($splListItem["_UIVersion"]) ver count : $($splListItem.File.Versions.Count)"
#check in file
try {
if ($checkin) {
$splListItem.File.CheckIn("CheckIn as admin");
}
}
catch {
WriteError "error CheckIn web $($web.ServerRelativeUrl) splList $($splList.RootFolder.ServerRelativeUrl) File id : $($splListItem.Id) "
}
#publish file
try {
if ($publish) {
$splListItem.File.Publish("Publish as admin");
}
}
catch {
WriteError "error Publish web $($web.ServerRelativeUrl) splList $($splList.RootFolder.ServerRelativeUrl) File id : $($splListItem.Id) "
}
#this is a folder
if ($splListItem.ContentTypeId.ToString() -eq "0x00C2208B8CE6E1422CADC1C521EAB2A68B") {
writeInfo "folder file $($splListItem.File.ServerRelativeUrl)"
continue
}
#delete old versions
if ($deleteAllVersion -and $splListItem.File -ne $null -and $splListItem.File.Versions -ne $null -and $splListItem.File.Versions.Count -gt 1) {
$splListItem.File.Versions.DeleteAll();
writeInfo "versions deleted for $($web.ServerRelativeUrl) splList $($splList.RootFolder.ServerRelativeUrl) File id : $($splListItem.Id)"
}
}
$iNumber += 1
$spqQuery.ListItemCollectionPosition = $splListItems.ListItemCollectionPosition;
}while ($spqQuery.ListItemCollectionPosition -ne $null)
$web.Dispose()
Sharepoint ajax Without Jquery
On 16/11/2018
On 03/11/2018
Set Content Type Field Property
On 22/10/2018
On 12/10/2018
Shrink Sql ContentDataBase Log
On 12/10/2018
USE WSS_Content_FDI80;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE WSS_Content_FDI80
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (WSS_Content_FDI80_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE WSS_Content_FDI80
SET RECOVERY FULL;
GO