Wednesday, September 12, 2018

Fetch data from multiple lists using SPSITEDATAQUERY

I knew posting on SPSITEDATAQUERY to too old , But recently I came ac-crossed requirement to get data from multiple lists . But I am posting this to keep the query handy

SPSiteDataQuery query = new SPSiteDataQuery ();
  // Query all Web sites in this site collection.
               Query. Webs = "<Webs Scope=\"SiteCollection\">";

               //Ask for all lists created from the contacts template.
               Query. Lists = "<Lists ServerTemplate=\"105\" />";

               // Get the Title (Last Name) and First Name fields.
               query.ViewFields = "<FieldRef Name=\"Title\" />";
               query.ViewFields += "<FieldRef Name=\"FirstName\" Nullable=\"TRUE\"/>";

               DataTable results = web.GetSiteData (query); 

Manage cloud identities with Windows using PowerShell


Changing Password
Set-MsolUserPassword –UserPrincipalName siddiq.ali@mycompany.onmicrosoft.com –NewPassword Pa$$w0rd –ForceChangePassword $true


Importing bulk users in Office 365 using Powershell
$NewUsers = Import-Csv –path .\NewUsers.csv


Applying Strong Password to the users
Set-MsolUser –UserPrincipalName siddiq.ali@mycompany.onmicrosoft.com
–StrongPasswordRequired $true

Powershell to set password to get never expires
Get-MsolUser | Set-MsolUser –PasswordNeverExpires $true

Configure password expiration

Set-MsolUser –UserPrincipalName siddiqali.mohammad@mycompany.onmicrosoft.com
–PasswordNeverExpires $true

REST API to filter null values for SharePoint list items

I am working for SharePoint online and I came crossed to get sharepoint list items based on null values via OTB web-part. Using IE browser I came to knew that I finding no luck to crack it.

Solution:

1. Use @v1 parameter for your rest api
2. And append the caml query @v1using $select

http://mysharepointsite/_api/web/Lists/GetByTitle('Documents1')/GetItems(query=@v1)?@v1={"ViewXml":"<View><Query><Where><And><IsNull><FieldRef Name='Selection'/></IsNull><Eq><FieldRef Name='EmpNumber'><Value Type='Text'>51457270</Value></Eq></And></Where></Query></View>"}&$select=Title


Friday, August 25, 2017

Unable to edit web part in a page

One of my business user added the page in site pages and included web part in it


And tried to edit the web-part , But I found no luck in getting the options
  
Solution:
  1. Open Internet Explorer, select the Tools button , and then select Compatibility View settings.
  2. Under Add this website, enter the URL of the site you want to add to the list, and then select Add  
                                                           or
Else it should be Microsoft Product issue

Tuesday, August 22, 2017

Set the co-authoring Limit for Web-application


Add-PSSnapin Microsoft.SharePoint.PowerShell
$site = Get-SPSite -Identity https://yourwebapplicationURL        
$site.Url
$site.WebApplication.WebService.CoauthoringMaxAuthors=19
$site.WebApplication.WebService.Update()
$site.Dispose()
Write-Host $site.WebApplication.WebService.CoauthoringMaxAuthors

The main purpose of the co-authoring is to limit the users for editing the particular document in document library .If the document is editing by too many users then users looses the UI experiance instantly ,So we limit the users interaction with co-authoring

Thursday, July 20, 2017

Find SharePoint Correlation-ID with Powershell

Today when I entered into my machine , I was getting correlation ID . I don't know where my team members changed the location of Log files from Hive 15 folder .

Then I used below by opening SharePoint Powershell command as administrator to fetech the log files 

Step 1: Merge-SPLogFile -Path ".\error.log" -Correlation "Correlation-ID"
Step 2: dir *.log

Tuesday, June 20, 2017

Powershell to find total documents in Farm

Get-SPSite -Limit All | Get-SPWeb -Limit All | % { $_.Lists} | ? { $_ -is [Microsoft.SharePoint.SPDocumentLibrary] } | % { $total+= $_.ItemCount} ; $total