SharePoint Online PowerShell Custom Group in Site Settings - powershell

I know how to use PowerShell to create a new SharePoint Site Settings link, but I cannot seem to find how to create a custom group within site settings.
Here is the code for creating the Custom Action:
$siteSettingLink = $Context.Web.UserCustomActions.Add();
$siteSettingLink.Group = "SiteTasks";
$siteSettingLink.Location = "Microsoft.SharePoint.SiteSettings";
$siteSettingLink.Name = "Sample_CustomSiteSetting";
$siteSettingLink.Sequence = 1000;
$siteSettingLink.Url = '/Pages/CustomPageContent.aspx';
$siteSettingLink.Title = "Custom Site Settings Link";
$siteSettingLink.Update();
$Context.ExecuteQuery();
Then the '.Group' property would reflect my custom group ID. I just cannot seem to figure out how to create the custom group using CSOM and PowerShell.
Here is the code to do it if you deploy the XML:
<CustomActionGroup Id="CannonFodderUtilities"
Location="Microsoft.SharePoint.Administration.Applications"
Title="Utitilies"
Sequence="80"
ImageUrl="/_layouts/15/images/CannonFodder/CannonFodderLogo.png"
xmlns="http://schemas.microsoft.com/sharepoint/" />
Sorry if this is a repost...I could not find anything through multiple searches.
Thanks in advance.

Related

Issue while adding/updating TOC in MS Word using OpenXML

I have a requirement to add/update TOC - Table of Contents in MS document using OpenXML. I am facing challenges to achieve the same. I am using MS Office 2016.
I have tried all the options from this post:
How to generate Table Of Contents using OpenXML SDK 2.0?
Also gone through Eric White videos.
I am trying to use UpdateField option and able to add empty TOC following the sample code from the above link.
However when I open the document I am not getting a pop-up dialog which will ask to update the TOC.
Here is the sample code:
var sdtBlock = new SdtBlock();
sdtBlock.InnerXml = GetTOC(); //TOC Xml
document.MainDocumentPart.Document.Body.AppendChild(sdtBlock);
DocumentFormat.OpenXml.Wordprocessing.SimpleField f;
f = new SimpleField();
f.Instruction = "sdtContent";
f.Dirty = true;
document.MainDocumentPart.Document.Body.Append(f);
var setting = document.MainDocumentPart.DocumentSettingsPart;
if (setting != null)
{
document.MainDocumentPart.DocumentSettingsPart.Settings.Append(new UpdateFieldsOnOpen() { Val = new DocumentFormat.OpenXml.OnOffValue(true)});
document.MainDocumentPart.DocumentSettingsPart.Settings.Save();
}
It is displaying default message, whereas I have valid entries (Headings).
Is it due to MS Office 2016? UpdateField Pop-up is not coming?
I don't want to go with below options:
Word Automation - Due to Microsoft.Office.Interop.Word
Word Automation Services - Require Sharepoint for this
Adding Macro - As it is asking to save the document every time I open it.
Also let me know if there is any better option to create/update TOC.
Your answer/comment is really very helpful.

Export Standard/Extended User Greetings (Exchange 2016) - For Use In XMedius AVST

In an earlier post on June 18, 2018 (my birthday BTW), a user asked "Hopefully a simple question - at one time I know when user's recorded their personal greetings for UM voicemail in o365 (regular greeting and/or extended absence greeting) these were stored in their Exchange inbox using a special item type (i.e. "IPM.Configuration.Um.CustomGreetings.External"). However setting up my test o365 setup, getting UM configured and all that, after recording my personal greeting and going through each item starting from the root of my inbox, (some 900+ items - lots of odd stuff in there) - I don't see anything like this any more. Lots of log, activity items, some messages but nothing about greetings. Extracting everything that could cast to an email type to a folder I went through each one - nothing promising. anyone have any clues where the custom greetings for users UM (not auto attendant recordings - that's a different beast) has gone off to and how to get to it?" After reading through the answers as well as the code that was provided by Jeff Lindborg, I thought that I was getting somewhere. With a lot of trial and error, I was finally able to get the EWS-FAI module installed as well as the Exchange Web Services API. Unfortunately, when it came to running the provided code, this is where I am stumped. I'm not a developer or 'coder' in any form, but I'm always looking for effective and efficient methods to do my work. With that said, I'm trying to run this on a Win10 workstation, but can't seem to figure out which program this needs to run within. I've tried Powershell, but that doesn't work. I have access to the necessary accounts for mailbox impersonation as well as any other permissions needed. I've provided the code that was originally supplied for review. Any additional help would be greatly appreciated.
Code
ExchangeService _service;
_service = new ExchangeService(ExchangeVersion.Exchange2016); // Exchange2013_SP1);
_service.Credentials = new WebCredentials("user#domain", "myPw");
_service.Url = new Uri("https://outlook.office365.com/EWS/Exchange.asmx");
//select the user you're fetching greetings for
_service.ImpersonatedUserId = new ImpersonatedUserId(ConnectingIdType.SmtpAddress, "user#domain");
//get the root folder for the current account
var oParamList = new List<FolderId> {WellKnownFolderName.Root};
var oTemp = _service.BindToFolders(oParamList, PropertySet.FirstClassProperties);
var oRoot = oTemp.First().Folder;
var oView = new ItemView(50)
{
PropertySet = new PropertySet(BasePropertySet.FirstClassProperties),
Traversal = ItemTraversal.Associated
};
SearchFilter oGreetingFilter = new SearchFilter.ContainsSubstring(ItemSchema.ItemClass,
"IPM.Configuration.Um.CustomGreetings", ContainmentMode.Substring, ComparisonMode.IgnoreCase);
var oResults = _service.FindItems(oRoot.Id, oGreetingFilter, oView);
//fetch the binary for the greetings as values
var oPropSet = new PropertySet(BasePropertySet.FirstClassProperties);
var oRoamingBinary = new ExtendedPropertyDefinition(31753, MapiPropertyType.Binary);
oPropSet.Add(oRoamingBinary);
_service.LoadPropertiesForItems(oResults, oPropSet);
var strFileName = "";
foreach (var oItem in oResults.Items)
{
if (oItem.ItemClass.Equals("IPM.Configuration.Um.CustomGreetings.External",
StringComparison.InvariantCultureIgnoreCase))
strFileName = "jlindborg_Standard.wav";
if (oItem.ItemClass.Equals("IPM.Configuration.Um.CustomGreetings.Oof",
StringComparison.InvariantCultureIgnoreCase))
strFileName = "jlindborg_Extended.wav";
File.WriteAllBytes("d:\\" + strFileName, (byte[]) oItem.ExtendedProperties.First().Value);
}
}
The code you posted is c# so you would need to use Visual Studio to create a C# application add a reference to the EWS Managed API and compile that for it to work (you'll need to engage a developer or learn some basic coding).
EWS-FAI is a powershell module it should be able to return that item and you should be able to write that to a file eg something like
$MailboxName = "mailbox#domain.com"
$Item = Get-FAIItem -MailboxName $MailboxName -ConfigItemName Um.CustomGreetings.External -Folder Inbox -ReturnConfigObject
[System.IO.File]::WriteAllBytes(("C:\temp\" + $MailboxName + ".wav"),$Item.BinaryData)

TFS 2013 - Link Work Items via Spreadsheet(.csv) powershell

I want to do linking between two workitems with the linking -> Affects ("Affects" and "Affected by Linking") or Testedby ("Tested" by and "tests Linking") ??
I am using the approach as as shown in below post TFS 2013 - Link Work Items via Spreadsheet
The problem is when I use ::TestedBy (code snippet is below) I don't get the result but when I used :: Hierarchy or ::Dependency or ::Related, I am getting the result and script works fine. Hierarchy ,Dependency ,Related work fine as they System defined Link types but TestedBy and Affects type of linking are Process-template defined link types.
https://msdn.microsoft.com/en-us/library/dd293527.aspx
Any help with this would be greatly appreciated please.
$hierarchyLink = $wis.WorkItemLinkTypes[[Microsoft.TeamFoundation.WorkItemTracking.Client.CoreLinkTypeReferenceNames]::TestedBy]
$link = new-object Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemLink($hierarchyLink.ReverseEnd, $map.Parent)
$childWIT.WorkItemLinks.Add($link)

Alfresco - Using email notification template not working properly

I'm using out-of-the-box Alfresco 4.2.f, without customizations, and i'm trying to set the email notification whether a new document in added in a certain folder.
So i've added a rule to the folder and i've set as Perform Action "Send email" using as template "notify_user_email_it.html.ftl".
If i insert a document, i don't receive the email and here is the error in the log:
Expression person is undefined on line 38, column 57 in workspace://SpacesStore/55088e2c-05ac-4264-8396-ee6f3c7021ad.
The problematic instruction:
----------
==> ${person.properties.firstName} [on line 38, column 55 in workspace://SpacesStore/55088e2c-05ac-4264-8396-ee6f3c7021ad]
----------
If i remove from the template the string ${person.properties.firstName} then the rule works properly but the mail i receive is not as expected, all the interesting informations are shown as in the original FTL. Attached the email received to understand better.
Really strange since i've not customized anything, maybe this is a BUG but i didn't find anything on JIRA...
Someone has the same behaviour? Possible work-arounds?
Thanks in advance!
According to this JIRA, it's not really a bug it just doesn't work for the admin user.
Have you tried it with a normal user?
--- Update ---
Maybe cause it's bug or an unimplemented feature something like the following to fix it in the template:
<#if person??>
.... set your person properties first & lastname
<#else>
.... is sure to be admin, so set the admin
</#if>
You have to pass the parameters to emails templates
you may try with this example
var template = "Data Dictionary/Email Templates/Workflow Notification/<<Your File>>.html.ftl";
var mail = actions.create("mail");
mail.parameters.to = "xyx#gmail.com";
mail.parameters.subject="Hello";
mail.parameters.text="blablabla";
mail.parameters.template = companyhome.childByNamePath(template);
var templateArgs = new Array();
templateArgs['workflowTitle'] = "789789";
templateArgs['workflowDescription'] = "879789";
templateArgs['workflowId'] = "879789";
var templateModel = new Array();
templateModel['args'] = templateArgs;
mail.parameters.template_model = templateModel;
mail.execute(bpm_package);
then you can get parameters using ${args.workflowTitle} in your Email template ftl file

QBO Queries and SpecifyOperatorOption

I'm trying to query QBO for, among other entities, Accounts, and am running into a couple of issues. I'm using the .Net Dev Kit v 2.1.10.0 (I used NuGet to update to the latest version) and when I use the following technique:
Intuit.Ipp.Data.Qbo.AccountQuery cquery = new Intuit.Ipp.Data.Qbo.AccountQuery();
IEnumerable<Intuit.Ipp.Data.Qbo.Account> qboAccounts = cquery.ExecuteQuery<Intuit.Ipp.Data.Qbo.Account>(context);
(i.e. just create a new AccountQuery of the appropriate type and call ExecuteQuery) I get an error. It seems that the request XML is not created properly, I just see one line in the XML file. I then looked at the online docs and tried to emulate the code there:
Intuit.Ipp.Data.Qbo.AccountQuery cquery = new Intuit.Ipp.Data.Qbo.AccountQuery();
cquery.CreateTime = DateTime.Now.Date.AddDays(-20);
cquery.SpecifyOperatorOption(Intuit.Ipp.Data.Qbo.FilterProperty.CreateTime,
Intuit.Ipp.Data.Qbo.FilterOperatorType.AFTER);
cquery.CreateTime = DateTime.Now.Date;
cquery.SpecifyOperatorOption(Intuit.Ipp.Data.Qbo.FilterProperty.CreateTime,
Intuit.Ipp.Data.Qbo.FilterOperatorType.BEFORE);
// Specify a Request validator
Intuit.Ipp.Data.Qbo.AccountQuery cquery = new Intuit.Ipp.Data.Qbo.AccountQuery();
IEnumerable<Intuit.Ipp.Data.Qbo.Account> qboAccounts = cquery.ExecuteQuery<Intuit.Ipp.Data.Qbo.Account>(context);
unfortunately, VS 2010 insists that AccountQuery doesn't contain a definition for SpecifyOperatorOption and there is no extension method by that name. So I'm stuck.
Any ideas how to resolve this would be appreciated.