Tuesday, April 18, 2017

Give Read Permission for SharePoint Add-in for Azure AD Send Mail to Office 365 Domain Group users.

Below are the Steps for Send Mail to Office 365 Domain Group or AD Group users from Provider Hosted ADD-IN. For this we needs to Give Permission for ADD-IN Client-ID.

1. Give Permission for Client-ID for Access AD Group. For this Open SharePoint online Management Power shell.  Run the Below

$msolcred = get-credential
connect-msolservice -credential $msolcred
## Set the add-in Client Id
$appId = "00000000-0000-0000-0000-0000000000000"

## get the add-in Service Principal
$appPrincipal = Get-MsolServicePrincipal -AppPrincipalId $appId 

## Get the Directory Readers Role
$directoryReaderRole = Get-MsolRole -RoleName "Directory Readers" 
##get the role you want to set

##Give the add-in the Directory Reader role
Add-MsolRoleMember -RoleMemberType ServicePrincipal -RoleObjectId $directoryReaderRole.ObjectId -RoleMemberObjectId $appPrincipal.ObjectId

##Confirm that the role has our add-in
Get-MsolRoleMember -RoleObjectId $directoryReaderRole.ObjectId

2. In My Example send Email from Remote Event Receiver. While Document Updated Alert Email send the uses available in Person or Group field. In this Example Azure Web-App as a Provider. Send Grid is used for SMTP.





Tuesday, March 25, 2014

Get users and groups from people/group column in sharepoint.

SPFieldUserValueCollection objUserFieldValueCol = new SPFieldUserValueCollection(properties.Web, item["users"].ToString());
for (int i = 0; i < objUserFieldValueCol.Count; i++)
{
SPFieldUserValue singlevalue = objUserFieldValueCol[i];
if (singlevalue.User == null)
{
//User
}
else
{
//All users from Group.
}
}

Wednesday, December 11, 2013

Missing server side dependencies. [MissingWebPart]

1.Enter as a Share Point Data Base Admin. Open SQL Server Management Studio.
Run the following Query
USE [WSS_Content_496dfc8bef2d46778f162ef78015268b]
SELECT * FROM AllDocs
INNER JOIN AllWebParts ON AllDocs.Id = AllWebParts.tp_PageUrlID
WHERE AllWebParts.tp_WebPartTypeID = '24019518-b52f-2e6d-868e-df1ed1b64b1d'



Modify the content Database and add web part ID

Tuesday, December 10, 2013

PowerShell Remove Features in SharePoint because of Health Issue For "Missing Feature"

Run The below power shell Method in SharePoint Management shell.
 function Remove-SPFeatureFromContentDB($ContentDb, $FeatureId, [switch]$ReportOnly)
{
    $db = Get-SPDatabase | where { $_.Name -eq $ContentDb }
    [bool]$report = $false
    if ($ReportOnly) { $report = $true }
   
    $db.Sites | ForEach-Object {
       
        Remove-SPFeature -obj $_ -objName "site collection" -featId $FeatureId -report $report
               
        $_ | Get-SPWeb -Limit all | ForEach-Object {
           
            Remove-SPFeature -obj $_ -objName "site" -featId $FeatureId -report $report
        }
    }
}
function Remove-SPFeature($obj, $objName, $featId, [bool]$report)
{
    $feature = $obj.Features[$featId]
   
    if ($feature -ne $null) {
        if ($report) {
            write-host "Feature found in" $objName ":" $obj.Url -foregroundcolor Red
        }
        else
        {
            try {
                $obj.Features.Remove($feature.DefinitionId, $true)
                write-host "Feature successfully removed from" $objName ":" $obj.Url -foregroundcolor Red
            }
            catch {
                write-host "There has been an error trying to remove the feature:" $_
            }
        }
    }
    else {
        #write-host "Feature ID specified does not exist in" $objName ":" $obj.Url
    }
}



To run only a report (-ReportOnly property):
Remove-SPFeatureFromContentDB -ContentDB "Content_DBName" -FeatureId "e8389ec7-70fd-4179-a1c4-6fcb4342d7a0" –ReportOnly

To remove the feature from all sites, site collections in the db run (no -ReportOnly property):
Remove-SPFeatureFromContentDB -ContentDB "Content_DBName" -FeatureId "8096285f-1473-45c7-85b7-f745e5b2cf29" 

Tuesday, December 3, 2013

Enable Bread crumb in sharepoint 2013

SharePoint 2007 and SharePoint 2010 we have Bread crumb option.  this feature is just disable by default. This post will help you enable it back using simple steps
1. You will need SharePoint Designer 2013 to achieve this. Once you have it downloaded and installed, open the SharePoint site in it.
2. Go to the Master page section and create a copy of the currently used master page. ( Its as simple as clicking on the master page -> copy -> right click -> paste :) )
3.Click on the newly created master page, and then click on edit file.
4. You will see the css code in it. Search for the term “GlobalBreadCrumbNavPopout” or “ms-breadcrumb-dropdownBox”. Below is a snapshot on how it looks
1
As highlighted, change the visible attribute to “true” and remove the tag  style=”display:none;”
5. After the changes, below is how your code should look like
2
6. Thats it!!.. Save the master page. Set it to default master page and you have the breadcrumb now available in your site.

Sharepoint Calendar Size Reduce as a Small Calendar

2010 CSS: /**** Small Calendar ***/
.ms-acal-item{height: 10px !important;}
.ms-acal-sdiv,
.ms-acal-mdiv,
.ms-acal-ctrlitem,
.ms-acal-month-weeksel,
.ms-acal-title{display: none;}
.ms-acal-summary-itemrow TD DIV{height: 15px !important;}
2013 Content Editor Web Part CSS: <style>
/**** Small Calendar ***/
.ms-acal-item{height: 10px !important;}
.ms-acal-sdiv,
.ms-acal-mdiv,
.ms-acal-ctrlitem,
.ms-acal-month-weeksel,
.ms-acal-title,
.ms-acal-month-top span{display: none;}
.ms-acal-summary-itemrow TD DIV{height: 15px !important;}
</style>

Thursday, June 14, 2012

Add Google search text box inside Sharepoint 2010 site

1. Go to Hive \Web Server Extensions\14\TEMPLATE\LAYOUTS\
2.. Create folder called Custom\goole.html
Copy the following code into Google.html

<html>
<form method="get" action="http://www.google.com/search" target='_blank'>


<div style="padding:4px; vertical-align:middle; ">
<table border="0" cellpadding="0" cellspacing="0" >
<tr><td valign="bottom" style=" height:75px; ">
<table cellpadding="0" cellspacing="0"><tr><td valign="middle" style="height:35px">
<input type="text"   name="q" size="25"
 maxlength="255" value="" />
</td><td>
<input type="image" value="Google Search" src="/_LAYOUTS/style/Images/Cute-Ball-Search-icon.png"/>
</td></tr></table>
</td>
</tr>
</table>
</div>


</form>
</html>


3.Add a Page Viewer web part add the following paths. /_layouts/Custom.google.html.

Give Read Permission for SharePoint Add-in for Azure AD Send Mail to Office 365 Domain Group users.

Below are the Steps for Send Mail to Office 365 Domain Group or AD Group users from Provider Hosted ADD-IN. For this we needs to Give Permi...