SharePoint Online Add-In 500 Internal Server Error

As you know when we deploy app online sharepoint , we can meet 500 Internal Server error in the on-premise sharepoint error, but how about this error on the cloud based online sharepoint? On-Premise sharepoint we can check IIS Log or SharePoint Central Administration, unfortunately there are no SharePoint Central Administration or IIS Log.

Error

HTTP 500 Internal Server Error when deploy sharepoint add-in to online sharepoint.

Which code made error

WebPartZone1.png If I added that part then , it made interanl server error, as if this web part or WebPartPages:XsltListViewPart doesn’t work well in this app.

Reference

This link is located in GitHub’s PnP explains , Developers should not simply include WebPart markup in the ASPX page itself. Doing so can cause errors when the add-in is updated.

webpartzone3.png

Summary

Obviously there are some changes for sharepoint development to add-ins. It needs to check GitHub’s PnP at first, then check the book or develop my own self.

 

 

Error of SharePoint-hosted app for deployed

I have error for deploying specific simple app to sharepoint-hosted on onffice 365 environment. But I’m not sure why it happens whenever I deploy sharepoint-app like An unexpected error has occurred.

Errors:

AppError.png

Resolution:

 

Get All Licenses users with Specific location

Hi, Today I need to calculate how many user licenses were assigned to my location.

Normally we need to know Get-MsolUser cmdlet at first.

And to see get-msoluser properties in the office 365 environment, we can use Get-MsolUser | Get-Member | Out-GridView , it shows , but there are a lot users on office 365, you need to use Get-MsolUser -all | Get-Member | Out-GridView

GetMsolUser This case to get “Get-MsolUser” properties, I must use -all parameter, it shows below, Today I’ll  use “IsLicensed”, “UsageLocation”, “UserPrincipalName”

getmsoluser-outgridview

Let’s get license user with specific location , to export csv file with column.

 

LicensesUsers I just added where-object {$_.isLicensed -eq $true -and $_.UsageLocation -eq “KR”, it distinguished and filtering  nicely to csv file, there are other options to use ExportCsv outer than for statement, but this is more easy to read document even if it takes time .

Conclusion

If you check cmdlet properties , you can use “Get-Member” cmdlet, and in this case , check your license user counts, and please check get-msoluser properties to get results more filtering to csv file.

 

Sideloading of apps is not enabled on this site

If you are making a site for app developing test….In this case normally we must create using development site. But sometimes we don’t know, so that deploy specific app project, it shows Error “Error occurred in deployment step ‘Install SharePoint Add-in: sideloading apps is not enabled on this site.

Solution : It needs to activate sideloading Features on the site.But I think it is able to activate on site collection features or site features, but no matter how  I check that features on site settings, there are no features, so you must use powershell, please check this link : I am also using this powershell then I activated it

EnabledSideLoading.png

Key is below like that

$sideLoadingGuid = new-object System.Guid “AE3A1339-61F5-4f8f-81A7-ABD2DA956A7D”
$site.Features.Add($sideLoadingGuid, $true, [Microsoft.SharePoint.Client.FeatureDefinitionScope]::None);

$cc.ExecuteQuery();

Then if I deploy my app to sharepoint, it is successfully deployed , but then it has problem which I’ve created.

Connect online sharepoint using powershell

When we connect online sharepoint , normal documents direct to using SharePoint Online Management Shell. OnlineManagementShell.png, but as you know that , it’s hard to make script using only this. It needs to install so as to use it, but it needs to call module.. so I will introduce how to authenticate , connect online sharepoint in my environment.

Script

Read-Host -Prompt “Enter password to be encrypted in sharepoint online mypassword.txt” -AsSecureString | ConvertFrom-SecureString | out-file “c:\sharepoint365connect.txt” [user input password stores as secure string to the file]

$password = cat “c:\sharepoint365connect.txt”| ConvertTo-SecureString
$auth = “global_admin_account”  [get content value from txt file then convert string value]

$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist $auth,$password  [new instance of powershell credential with user id and password ]

Import-Module Microsoft.Online.SharePoint.PowerShell [load online sharepoint module]
Connect-SPOService -url https://cloudwide1603-admin.sharepoint.com -Credential $mycred [connect online sharepoint admin center]

Summary

You must input your credentials to connect sharepoint online module after then you can create , edit, sort of workings on the powershell. And there are more method to connect online sharepoint. You need to make your own method I hope.

 

 

Creating SharePoint Online SiteCollection

To create sharepoint online site collection , you need to check and use “New-SPOSite” cmdlet. It describes “creates a new site collection for the current company”, it needs to load “Import-Module Microsoft.Online.SharePoint.PowerShell ” module and authentication and connect-spo service before using create sharepoint cmdlet after remote connection via powershell.

Parameters

  • Url : [Required] Specifies the full URL of the new site collection, must be in a valid managed company’s site, valid managed paths are https://contoso.sharepoint.com and https://contoso.sharepoint.com/teams  for company contoso
  • Owner : [Required] : user name of the site colletion’s owner, must be user , security gorup , or email-enabled security group
  • StorageQuota : [Required] : the storage quota for this creating site collection in megabytes. It must be set lower than 1024 megabytes.
  • CompatibilityLevel, LocaleId, NoWait, ResourceQuota, Template, TimeZoneId, Title , these are optional parameters
  • Owner must be user related active directory
  • One Site Collection Quota is 1 terra bytes.

Site Creation

CmdLet

New-SPOSite -Url https://cloudwide1603.sharepoint.com/sites/devSite -Owner owner’s email address -Template STS#0 -Title “Dev site” -StorageQuota 5000 -CompatibilityLevel 15ShowSiteCollectioList.pngthen it can show site collection which I created using powershell.

Summary

If is easy to create site collecton using powershell like GUI creation page. And I think we need to list up Template list to create various sites, teamsite, blog, search center…

 

Managing your own domain to Office 365[1]

If we create my own tenant on office 365, it creates domain tenantName.onmicrosoft.com. but this domain looks difficult to memorize it, so if you have your own domain , you can change domain easy to memorize it.

Adding a New Domain

Adding a new domain in Windows Azure Active Directory  , there are three steps

  1. Add and validate the actual domain;
  2. Configure and validate DNS records (domain purpose);
  3. Configure or add users

Add and validate the actual domain

To add a new domain we can use the New-MsolDomain cmdlet with -Name option, I did only use -Name option , but needs to -Authentication options is used to pass the type of domain, which is either Managed or Federated. if we are using ADFS with DirSync as Azure Directory Service, we are using Federated, [I will configure ‘Federated’ domain after a few days during installation of ADFS] but in this example use Managed.

New-MsolDomain -Authentication Managed -Name YSAH.ORGManagedDomain.pngWhen the domain is entered into Office 365 , it needs to be validated with the Get-MsolDomainVerificationDns cmdlet. If you use Get-Help Get-MsolDomainVerification -Full, it describes “Retrieves a list of records to configure a domain“, if we are configure on the office 365 admin portal dns page, we must set txt record or mx record to verify a new domain is mine or not. Also if you want to use Skype , Online SharePoint, etc.. it needs to set srv records to azure active directory.  I prefer to use a TXT record (DnsTxtRecord) than MX record (DnsMxRecord) to verify domain.   Get-MsolDomainVerificationDns -DomainName YSAH.ORG -Mode DnsTxtRecord , it returns txt record.GetTxtRecord.png After adding this record to public DNS which I bought that domain, must be verified using the Confirm-MsolDomain cmdlet. Confirm-MsolDomain -DomainName YSAH.ORG  , it returns AvailabilityDetails

confirmmsoldomain.png  The domain is now added to Office 365 with my test tenant ,

Configure and validate DNS records (domain purpose)

The next step in the Mircrosoft Online Portal is to configure uses and the domain purposes. i.e. used with Exchange Online and Skype Online. Based on your selections the DNS records are shows which you have to configure. If I check the status is Setup in progress (domain verified) is shown . domainverifed.pngUnfortunately it is not possible using Powershell to configure the domain purpsose, so you have to use the Microsoft Online Portal or leave it this way.

Formally you don’t have a finalized domain setup and as such you most likely will be in an unsupported configuration. The domain purpose is configured on the domain, when you use the command Get-MsolDomain | select Name, capabilities in Powershell on the domain purpose is actually shown when the domain is configured in the Microsoft Online Portal. getmsoldomain.png The differences are clearly visible. The ysah.org domain is created using PowerShell, On the other hand , when you leave it this way the entire configure will work as expected, as long as you configure your public DNS with the correct entries. Frankly this configure and validate DNS record items looks difficult, so as to use Exchange Online , Skype Online , it needs to set record to public DNS entries. but I don’t know what is public DNS entries, my domain ,

New domains in Exchange Online

When you’ve added a new domain in Azure Active Directory , it is automatically added to Exchange Online as an ‘authoritative domain’.

 

Summary

You can use PowerShell without configuring Office 365 Admin Portal Page. Creating new domain and setting values are easy than we expected. But domain purpose is not configurable via PowerShell, I’ll check more and more “domain purpose”

 

Change mail domain using Set-MsolDomain cmdlet

Hi, I need to rollback and deactivate my domain to my tenant, so as to this job, we can move to office 365 admin portal, then go to domain, select domain which we want to set as default. But today I want to use Set-MsolDomain cmdlet.


First.png This is ysah.org domain set as Default, but if we execute it as Set-MsolDomain -name cloudwide1602.onmicrosoft.com -IsDefault , the logout then re login, default domain changes to cloduwide1602.onmicrosoft.com

later.png

 

Remove all license user without one user as global admin

Hi, I would like to remove all license user without global admin, this account needs to deactivate domain connection. And if we remove office 365 license users, it moves to recyle bin as soft delete,  in this case if we need to recover it, it is so easy and usefulness, but after 30 days, we cannot restore their users anymore. Sometimes we want to remove users without storing recycle bin about 30 days,  to execute this command we need to declare

  1. Get all licesne users without one specific user then export to csv file.
  2. Store user’s userprincipalName using Import-Csv with specific csv file.
  3. In the for loop statement, Remove-MsolUser with reference userprincipalName which we’ve gotten already to set, with -force option
  4. Repeat all statements in the for-loop statements
  5. Get all users from recyle-bin , which are already removed as soft-delete , then remove-msolUser from RecyleBin with -RemoveFromRecyleBin and -Force option

To use on this declarations, we can make powershell document

Get-MsolUser | Where-Object {$_.isLicensed -eq “TRUE” -and $_.UserPrincipalName -ne “UserPrincipalNameEmail”} | Export-csv d:\cloudwide1602Users.csv
$users = Import-csv d:\cloudwide1602Users.csv
foreach ($user in $users){
    Remove-MsolUser -UserPrincipalName $user.UserPrincipalName -Force
}

Get-MsolUser -ReturnDeletedUsers | Remove-MsolUser -RemoveFromRecycleBin -Force

To execute this cmdlet, then if I move to deleted users page on office 365 portal, there is no deleted users to recover.

Get all license users list without specific user

Hi, During clean-up already created licenses users without global admin on office 365, so as to make it with all users without one global admin, I will show some cmdlet and contents.


Let’s see Get-MsolUser cmdlet, if we execute to get all available properties, let me execute Get-MsolUser | Get-Member | Out-GridView , it shows up Grid View format with all properties we can use, AllProperties.pngSo as to get all license user, we can use  Get-MsolUser | Where-Object  {$_.isLicensed -eq “TRUE”} , it retrieves all users with have licenses on this tenant.  If we check $_.xxxxx format, it uses with properties, if we want to export all license users to csv file, we can use  Get-MsolUser | Where-Object {$_.isLicensed -eq “TRUE”} | Export-Csv c:\Licenses.csv


Let’s assume to get all license users without specific user, how can we make cmdlet? It needs to use -and and more condition such as $_.UserPrincipalName -ne “userPrincipalName” ,  if my tenant have global administrator is hongwoo@ysah.org, I want to get all license users without one global administrator, how can I do it?  Get-MsolUser | Where-Object {$_.isLicensed -eq “TRUE” -and $_.UserPrincipalName -ne “hongwoo@ysah.org”}  ,  this statmemt make a result to retrieve all license users without one global administrator.

텐서 플로우 블로그 (Tensor ≈ Blog)

머신러닝(Machine Learning), 딥러닝(Deep Learning) 그리고 텐서(Tensor) 또 파이썬(Python)

Jaap Wesselius

Microsoft UC Specialist

Office365 Cloud for My site

Office365 & SharePoint & PowerShell