Skip to content

Instantly share code, notes, and snippets.

View emregulcan's full-sized avatar
☠️

Emre GULCAN emregulcan

☠️
View GitHub Profile
@emregulcan
emregulcan / PowerApps_PowerShell_List_Applications
Created February 18, 2022 23:14
List PowerApps applications that match criteria
Get-AdminPowerApp -Owner '{guid}' -EnvironmentName '{guid}'
@emregulcan
emregulcan / PowerApps_CanvasApplication_Change_Owner
Created February 18, 2022 00:28
Change Power Apps Canvas Application Owner Information by using PowerShell
Set-AdminPowerAppOwner -AppName '{guid}' -AppOwner '{guid}' -EnvironmentName '{guid}'
@emregulcan
emregulcan / PowerApps_Modules_for_PowerShell
Created February 17, 2022 22:29
Install PowerApps modules for PowerShell
Install-Module -Name Microsoft.PowerApps.Administration.PowerShell
Install-Module -Name Microsoft.PowerApps.PowerShell -AllowClobber
@emregulcan
emregulcan / d365_ExecuteMultipleRequest_sample.cs
Created March 28, 2021 02:11
Dynamics 365 CE (CRM) ExecuteMultipleRequest code sample
try
{
/*
* INFO :
* List<OrganizationRequest> requestList olarak oluşturduğum değişken mevcutta kurguladığımız entegrasyon yapısı için
* data kaynağından gelecek olan kayıtları içermektedir.
* Örnek kodumuzda sadece Contact create işlemi yapıyoruz, gerçek dünya senaryolarında kayıt güncelleme, silme, ilişkilendirme vb.
* işlemleri de aynı şekilde yapabilirsiniz.
*/
@emregulcan
emregulcan / d365_ExecuteMultipleRequest_split_request_package.cs
Created March 28, 2021 00:47
Dynamics 365 CE (CRM) ExecuteMultipleRequest package split
int itemPerPackage = 150; //INFO : Her bir istekte pakette bulunmasını istediğimiz Request sayısı
int packageCount = 1;
if (requestList.Count > itemPerPackage)
{
packageCount = requestList.Count / itemPerPackage;
if (packageCount % itemPerPackage != 0)
{
packageCount++;
@emregulcan
emregulcan / isDashboardPage.js
Last active July 18, 2020 21:05
Detect Dynamics 365 CE dashboard page (Alternate 01)
function isDashboardPage() {
let url = window.location;
if (url.search.indexOf("pagetype=dashboard") === -1 && window.parent != undefined && window.parent != null) {
url = window.parent.location;
}
return (url.search.indexOf("pagetype=dashboard") > -1);
}
@emregulcan
emregulcan / d365_dataexportservice_delete_single_item.sql
Created May 11, 2019 01:39
Dynamics 365 CE (CRM) Data Export Service - Azure SQL Database Delete Single Item
-----------------------------------------------------------------
-- Provide the value for the following parameters
DECLARE @prefix nvarchar(32) =''
DECLARE @schema nvarchar(32) =''
DECLARE @entityName nvarchar(32) =''
-----------------------------------------------------------------
DECLARE @sql nvarchar(max) = '';
IF @prefix != ''
BEGIN
@emregulcan
emregulcan / d365_dataexportservice_delete_all_items.sql
Created May 11, 2019 01:29
Dynamics 365 CE (CRM) Data Export Service - Azure SQL Database Delete All Items
-----------------------------------------------------------------
-- Provide the value for the following parameters
DECLARE @prefix nvarchar(32) =''
DECLARE @schema nvarchar(32) ='dbo'
-----------------------------------------------------------------
DECLARE @sql nvarchar(max) = '';
SELECT @sql += 'DROP TABLE ' + QUOTENAME([TABLE_SCHEMA]) + '.' + QUOTENAME([TABLE_NAME]) + ';'
FROM [INFORMATION_SCHEMA].[TABLES]
@emregulcan
emregulcan / d365_dataexportservice_keyvault_powershell.ps1
Created May 11, 2019 01:12
Dynamics 365 CE (CRM) Data Export Service - Setup Azure Key Vault
# -------------------------------------------------------------------------------- #
# Provide the value for the following parameters before executing the script
# This Powershell script copied from Microsoft official documentation on 2019-05-10
# Please check and validate before use, https://docs.microsoft.com/en-us/previous-versions/dynamicscrm-2016/administering-dynamics-365/mt744592(v=crm.8)
$subscriptionId = '[Specifies the Azure subscription to which the Key Vault belongs.]'
$keyvaultName = '[Specifies the name of the Key Vault. If the Key Vault does not exist, the script will create one]'
$secretName = '[Specifies the name of the secret that is put into the Key Vault. The secret holds the destination database connection string.]'
$resourceGroupName = '[Specifies the Resource Group for the Key Vault.]'
@emregulcan
emregulcan / d365_webapi_update_record.cs
Created May 2, 2019 22:44
Dynamics 365 CE (CRM) Web API update existing data
public void Update(string entityLogicalName, Guid id, object updateContent)
{
string apiBaseUrl = $"{_d365Url}/api/data/v9.1";
string apiFullUrl = $"{apiBaseUrl}/{entityLogicalName}s({id.ToString()})";
using (HttpClient httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _accessToken);
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));