mirror of
https://github.com/paradizelost/PSTeedy.git
synced 2025-04-02 16:55:02 -05:00
inital move to a module
This commit is contained in:
parent
a82d4b5198
commit
563c377abc
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
||||
* -crlf
|
62
.github/CONTRIBUTING.md
vendored
Normal file
62
.github/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
# How to contribute
|
||||
|
||||
Contributions to PSTeedy are highly encouraged and desired.
|
||||
Below are some guidelines that will help make the process as smooth as possible.
|
||||
|
||||
## Getting Started
|
||||
|
||||
- Make sure you have a [GitHub account](https://github.com/signup/free)
|
||||
- Submit a new issue, assuming one does not already exist.
|
||||
- Clearly describe the issue including steps to reproduce when it is a bug.
|
||||
- Make sure you fill in the earliest version that you know has the issue.
|
||||
- Fork the repository on GitHub
|
||||
|
||||
## Suggesting Enhancements
|
||||
|
||||
I want to know what you think is missing from PSTeedy and how it can be made better.
|
||||
|
||||
- When submitting an issue for an enhancement, please be as clear as possible about why you think the enhancement is needed and what the benefit of it would be.
|
||||
|
||||
## Making Changes
|
||||
|
||||
- From your fork of the repository, create a topic branch where work on your change will take place.
|
||||
- To quickly create a topic branch based on master; `git checkout -b my_contribution master`.
|
||||
Please avoid working directly on the `master` branch.
|
||||
- Make commits of logical units.
|
||||
- Check for unnecessary whitespace with `git diff --check` before committing.
|
||||
- Please follow the prevailing code conventions in the repository.
|
||||
Differences in style make the code harder to understand for everyone.
|
||||
- Make sure your commit messages are in the proper format.
|
||||
|
||||
```
|
||||
Add more cowbell to Get-Something.ps1
|
||||
|
||||
The functionality of Get-Something would be greatly improved if there was a little
|
||||
more 'pizzazz' added to it. I propose a cowbell. Adding more cowbell has been
|
||||
shown in studies to both increase one's mojo, and cement one's status
|
||||
as a rock legend.
|
||||
```
|
||||
|
||||
- Make sure you have added all the necessary Pester tests for your changes.
|
||||
- Run _all_ Pester tests in the module to assure nothing else was accidentally broken.
|
||||
|
||||
## Documentation
|
||||
|
||||
I am infallible and as such my documenation needs no corectoin.
|
||||
In the highly unlikely event that that is _not_ the case, commits to update or add documentation are highly apprecaited.
|
||||
|
||||
## Submitting Changes
|
||||
|
||||
- Push your changes to a topic branch in your fork of the repository.
|
||||
- Submit a pull request to the main repository.
|
||||
- Once the pull request has been reviewed and accepted, it will be merged with the master branch.
|
||||
- Celebrate
|
||||
|
||||
## Additional Resources
|
||||
|
||||
- [General GitHub documentation](https://help.github.com/)
|
||||
- [GitHub forking documentation](https://guides.github.com/activities/forking/)
|
||||
- [GitHub pull request documentation](https://help.github.com/send-pull-requests/)
|
||||
- [GitHub Flow guide](https://guides.github.com/introduction/flow/)
|
||||
- [GitHub's guide to contributing to open source projects](https://guides.github.com/activities/contributing-to-open-source/)
|
||||
|
31
.github/ISSUE_TEMPLATE.md
vendored
Normal file
31
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
<!--- Provide a general summary of the issue in the Title above -->
|
||||
|
||||
## Expected Behavior
|
||||
<!--- If you're describing a bug, tell us what should happen -->
|
||||
<!--- If you're suggesting a change/improvement, tell us how it should work -->
|
||||
|
||||
## Current Behavior
|
||||
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
|
||||
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
|
||||
|
||||
## Possible Solution
|
||||
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
|
||||
<!--- or ideas how to implement the addition or change -->
|
||||
|
||||
## Steps to Reproduce (for bugs)
|
||||
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
||||
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
4.
|
||||
|
||||
## Context
|
||||
<!--- How has this issue affected you? What are you trying to accomplish? -->
|
||||
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
|
||||
|
||||
## Your Environment
|
||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||
* Module version used:
|
||||
* Operating System and PowerShell version:
|
||||
|
37
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
37
.github/PULL_REQUEST_TEMPLATE.md
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
<!--- Provide a general summary of your changes in the Title above -->
|
||||
|
||||
## Description
|
||||
<!--- Describe your changes in detail -->
|
||||
|
||||
## Related Issue
|
||||
<!--- This project only accepts pull requests related to open issues -->
|
||||
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
|
||||
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->
|
||||
<!--- Please link to the issue here: -->
|
||||
|
||||
## Motivation and Context
|
||||
<!--- Why is this change required? What problem does it solve? -->
|
||||
|
||||
## How Has This Been Tested?
|
||||
<!--- Please describe in detail how you tested your changes. -->
|
||||
<!--- Include details of your testing environment, and the tests you ran to -->
|
||||
<!--- see how your change affects other areas of the code, etc. -->
|
||||
|
||||
## Screenshots (if appropriate):
|
||||
|
||||
## Types of changes
|
||||
<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->
|
||||
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||
- [ ] New feature (non-breaking change which adds functionality)
|
||||
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
||||
|
||||
## Checklist:
|
||||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
|
||||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->
|
||||
- [ ] My code follows the code style of this project.
|
||||
- [ ] My change requires a change to the documentation.
|
||||
- [ ] I have updated the documentation accordingly.
|
||||
- [ ] I have read the **CONTRIBUTING** document.
|
||||
- [ ] I have added tests to cover my changes.
|
||||
- [ ] All new and existing tests passed.
|
||||
|
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Don't check in the Output dir
|
||||
Output/
|
8
.vscode/extensions.json
vendored
Normal file
8
.vscode/extensions.json
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"ms-vscode.PowerShell",
|
||||
"DavidAnson.vscode-markdownlint"
|
||||
]
|
||||
}
|
7
.vscode/settings.json
vendored
Normal file
7
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"files.insertFinalNewline": true,
|
||||
"editor.insertSpaces": true,
|
||||
"editor.tabSize": 4,
|
||||
"powershell.codeFormatting.preset": "OTBS"
|
||||
}
|
74
.vscode/tasks.json
vendored
Normal file
74
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
|
||||
// Start PowerShell (pwsh on *nix)
|
||||
"windows": {
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "powershell.exe",
|
||||
"args": [ "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
"linux": {
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "/usr/bin/pwsh",
|
||||
"args": [ "-NoProfile", "-Command" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
"osx": {
|
||||
"options": {
|
||||
"shell": {
|
||||
"executable": "/usr/local/bin/pwsh",
|
||||
"args": [ "-NoProfile", "-Command" ]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"tasks": [
|
||||
{
|
||||
"label": "Clean",
|
||||
"type": "shell",
|
||||
"command": "${cwd}/build.ps1 -Task Clean -Verbose"
|
||||
},
|
||||
{
|
||||
"label": "Test",
|
||||
"type": "shell",
|
||||
"command": "${cwd}/build.ps1 -Task Test -Verbose",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": "$pester"
|
||||
},
|
||||
{
|
||||
"label": "Analyze",
|
||||
"type": "shell",
|
||||
"command": "${cwd}/build.ps1 -Task Analyze -Verbose"
|
||||
},
|
||||
{
|
||||
"label": "Pester",
|
||||
"type": "shell",
|
||||
"command": "${cwd}/build.ps1 -Task Pester -Verbose",
|
||||
"problemMatcher": "$pester"
|
||||
},
|
||||
{
|
||||
"label": "Build",
|
||||
"type": "shell",
|
||||
"command": "${cwd}/build.ps1 -Task Build -Verbose",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "Publish",
|
||||
"type": "shell",
|
||||
"command": "${cwd}/build.ps1 -Task Publish -Verbose"
|
||||
}
|
||||
]
|
||||
}
|
9
CHANGELOG.md
Normal file
9
CHANGELOG.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [0.1.0] Unreleased
|
||||
|
124
PSTeedy/PSTeedy.psd1
Normal file
124
PSTeedy/PSTeedy.psd1
Normal file
@ -0,0 +1,124 @@
|
||||
#
|
||||
# Module manifest for module 'PSTeedy'
|
||||
#
|
||||
# Generated by: paradizelost
|
||||
#
|
||||
# Generated on: 22/12/2020
|
||||
#
|
||||
|
||||
@{
|
||||
|
||||
# Script module or binary module file associated with this manifest.
|
||||
RootModule = 'PSTeedy.psm1'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '0.1.0'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
||||
# ID used to uniquely identify this module
|
||||
GUID = 'd20bdef4-0086-4b72-a291-a0388323d1f8'
|
||||
|
||||
# Author of this module
|
||||
Author = 'paradizelost'
|
||||
|
||||
# Company or vendor of this module
|
||||
#CompanyName = 'Unknown'
|
||||
|
||||
# Copyright statement for this module
|
||||
Copyright = '(c) 2020 paradizelost. All rights reserved.'
|
||||
|
||||
# Description of the functionality provided by this module
|
||||
Description = 'Powershell Module for interfacing with Teedy from Teedy.io'
|
||||
|
||||
# Minimum version of the Windows PowerShell engine required by this module
|
||||
PowerShellVersion = '5.1'
|
||||
|
||||
# Name of the Windows PowerShell host required by this module
|
||||
# PowerShellHostName = ''
|
||||
|
||||
# Minimum version of the Windows PowerShell host required by this module
|
||||
# PowerShellHostVersion = ''
|
||||
|
||||
# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
|
||||
# DotNetFrameworkVersion = ''
|
||||
|
||||
# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.
|
||||
# CLRVersion = ''
|
||||
|
||||
# Processor architecture (None, X86, Amd64) required by this module
|
||||
# ProcessorArchitecture = ''
|
||||
|
||||
# Modules that must be imported into the global environment prior to importing this module
|
||||
# RequiredModules = @()
|
||||
|
||||
# Assemblies that must be loaded prior to importing this module
|
||||
# RequiredAssemblies = @()
|
||||
|
||||
# Script files (.ps1) that are run in the caller's environment prior to importing this module.
|
||||
# ScriptsToProcess = @()
|
||||
|
||||
# Type files (.ps1xml) to be loaded when importing this module
|
||||
# TypesToProcess = @()
|
||||
|
||||
# Format files (.ps1xml) to be loaded when importing this module
|
||||
# FormatsToProcess = @()
|
||||
|
||||
# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess
|
||||
# NestedModules = @()
|
||||
|
||||
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
|
||||
FunctionsToExport = '*'
|
||||
|
||||
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
|
||||
CmdletsToExport = '*'
|
||||
|
||||
# Variables to export from this module
|
||||
VariablesToExport = '*'
|
||||
|
||||
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
|
||||
AliasesToExport = '*'
|
||||
|
||||
# DSC resources to export from this module
|
||||
# DscResourcesToExport = @()
|
||||
|
||||
# List of all modules packaged with this module
|
||||
# ModuleList = @()
|
||||
|
||||
# List of all files packaged with this module
|
||||
# FileList = @()
|
||||
|
||||
# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.
|
||||
PrivateData = @{
|
||||
|
||||
PSData = @{
|
||||
|
||||
# Tags applied to this module. These help with module discovery in online galleries.
|
||||
# Tags = @()
|
||||
|
||||
# A URL to the license for this module.
|
||||
# LicenseUri = ''
|
||||
|
||||
# A URL to the main website for this project.
|
||||
# ProjectUri = ''
|
||||
|
||||
# A URL to an icon representing this module.
|
||||
# IconUri = ''
|
||||
|
||||
# ReleaseNotes of this module
|
||||
# ReleaseNotes = ''
|
||||
|
||||
} # End of PSData hashtable
|
||||
|
||||
} # End of PrivateData hashtable
|
||||
|
||||
# HelpInfo URI of this module
|
||||
# HelpInfoURI = ''
|
||||
|
||||
# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.
|
||||
# DefaultCommandPrefix = ''
|
||||
|
||||
}
|
||||
|
||||
|
13
PSTeedy/PSTeedy.psm1
Normal file
13
PSTeedy/PSTeedy.psm1
Normal file
@ -0,0 +1,13 @@
|
||||
# Dot source public/private functions
|
||||
$public = @(Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath 'Public/*.ps1') -Recurse -ErrorAction Stop)
|
||||
$private = @(Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath 'Private/*.ps1') -Recurse -ErrorAction Stop)
|
||||
foreach ($import in @($public + $private)) {
|
||||
try {
|
||||
. $import.FullName
|
||||
}
|
||||
catch {
|
||||
throw "Unable to dot source [$($import.FullName)]"
|
||||
}
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function $public.Basename
|
3
PSTeedy/Private/GetHelloWorld.ps1
Normal file
3
PSTeedy/Private/GetHelloWorld.ps1
Normal file
@ -0,0 +1,3 @@
|
||||
function GetHelloWorld {
|
||||
'Hello world'
|
||||
}
|
23
PSTeedy/Public/Add-TeedyFile.ps1
Normal file
23
PSTeedy/Public/Add-TeedyFile.ps1
Normal file
@ -0,0 +1,23 @@
|
||||
function Add-TeedyFile(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[Parameter(Mandatory=$false)]
|
||||
[String[]]$DocumentID,
|
||||
[Parameter(Mandatory=$false)]
|
||||
[String[]]$FileID
|
||||
)
|
||||
|
||||
#TODO: Need to restructure the IF statements so that the should process makes sense.
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
foreach($File in @($FileID)) {
|
||||
foreach($Document in @($DocumentID)) {
|
||||
$ToAttach=@{
|
||||
FileID=$File;
|
||||
ID=$Document
|
||||
}
|
||||
|
||||
Invoke-RestMethod -uri "$siteurl/api/File/$File/attach" -Headers $headers -Method POST -Body $ToAttach -ContentType 'application/x-www-form-urlencoded' -WebSession $global:LoginSession
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
PSTeedy/Public/Connect-Teedy.ps1
Normal file
36
PSTeedy/Public/Connect-Teedy.ps1
Normal file
@ -0,0 +1,36 @@
|
||||
function Connect-Teedy(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$Username,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$Password,
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$URL
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$URL", "Logging into the Teedy instance")) {
|
||||
$global:SiteURL=$URL
|
||||
$tologin=@{Username="$Username";Password="$Password";}
|
||||
try{
|
||||
$loginresponse = Invoke-webrequest -Uri "$SiteURL/api/user/login" -Method POST -Body $tologin -SessionVariable Session
|
||||
} catch {
|
||||
if(($error[0].ErrorDetails.Message|convertfrom-json|select-object -ExpandProperty Type) -eq 'ValidationCodeRequired'){
|
||||
$mfacode = read-host "MFA Code Required for user. Please enter MFA Code:"
|
||||
if($mfacode -match '\d{6}'){
|
||||
$tologin.add('code',$mfacode)
|
||||
$loginresponse = Invoke-webrequest -Uri "$SiteURL/api/user/login" -Method POST -Body $tologin -SessionVariable Session
|
||||
}
|
||||
}
|
||||
}
|
||||
if($loginresponse.baseresponse.StatusCode -eq 200){
|
||||
write-host "Logged in successfully"
|
||||
}
|
||||
$global:loginsession = $session
|
||||
$headercookie = ($loginresponse|select-object -ExpandProperty Headers)["Set-Cookie"]
|
||||
$token,$null = $headercookie -split ";"
|
||||
$headers=@{
|
||||
Cookie = "$token"
|
||||
}
|
||||
return $headers
|
||||
}
|
||||
}
|
16
PSTeedy/Public/Get-TeedyDocumentByTag.ps1
Normal file
16
PSTeedy/Public/Get-TeedyDocumentByTag.ps1
Normal file
@ -0,0 +1,16 @@
|
||||
function Get-TeedyDocumentByTag(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[parameter(mandatory)]$Tag
|
||||
)
|
||||
|
||||
If($PSCmdlet.ShouldProcess("$Tag", "Getting documents")) {
|
||||
update-Taghash
|
||||
if(-not($global:Taghash[$Tag])){
|
||||
write-host "Tag $Tag not found."
|
||||
break
|
||||
}
|
||||
$DocumentList=Invoke-RestMethod -uri "$siteurl/api/document/list" -Headers $headers -Method GET -Body @{search="Tag:$Tag";limit=0 } -WebSession $global:loginsession| select-object -ExpandProperty documents|select-object -ExpandProperty id
|
||||
$DocumentList
|
||||
}
|
||||
}
|
9
PSTeedy/Public/Get-TeedyDocumentTags.ps1
Normal file
9
PSTeedy/Public/Get-TeedyDocumentTags.ps1
Normal file
@ -0,0 +1,9 @@
|
||||
function Get-TeedyDocumentTags(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[parameter(mandatory)]$documentid
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
Invoke-RestMethod -uri "$siteurl/api/document/$DocumentID" -Headers $headers -body @{id=$documentId} -Method GET -WebSession $global:loginsession|select-object -ExpandProperty tags
|
||||
}
|
||||
}
|
11
PSTeedy/Public/Get-TeedyTagByPartialName.ps1
Normal file
11
PSTeedy/Public/Get-TeedyTagByPartialName.ps1
Normal file
@ -0,0 +1,11 @@
|
||||
function Get-TeedyTagByPartialName(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[parameter(mandatory)]
|
||||
$tagPartialName
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
Update-TagHash
|
||||
$global:taghash.keys|where-object {$_ -like $tagPartialName}
|
||||
}
|
||||
}
|
92
PSTeedy/Public/New-TeedyDirectory.ps1
Normal file
92
PSTeedy/Public/New-TeedyDirectory.ps1
Normal file
@ -0,0 +1,92 @@
|
||||
function New-TeedyDirectory(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
$AnchorTag='DirUploadTest',
|
||||
$Directory='C:\Users\dan\teedytest',
|
||||
[switch]$DontUseExistingTags,
|
||||
[switch]$OnlyCreateTags,
|
||||
[switch]$AddAllDirsAsTags,
|
||||
[switch]$ExractMSGFiles,
|
||||
$Tags
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
if($ExractMSGFiles){
|
||||
$script:ExtractMSG=$true
|
||||
}
|
||||
if($directory[-1] -eq '\'){
|
||||
$directory = $directory.substring(0,$directory.length -1)
|
||||
}
|
||||
Update-TagHash
|
||||
if(-not($global:taghash[$AnchorTag])){
|
||||
new-tag -TagName $AnchorTag
|
||||
}
|
||||
$importbatchtag = "IMPORTBATCH-$(get-date -format yyyyMMddmmss)"
|
||||
new-tag -TagName $importbatchtag -ParentTagName $AnchorTag
|
||||
|
||||
$directories = @(get-childitem -Path $directory -Directory -Recurse)
|
||||
$directories += Get-item -path $directory
|
||||
$directories = $directories|sort-object
|
||||
foreach($mydirectory in $directories){
|
||||
$specialtags=@()
|
||||
if($mydirectory.FullName -eq $directory){
|
||||
$specialtags+=$AnchorTag
|
||||
}else{
|
||||
$myparts = @(($mydirectory.fullname -replace [regex]::escape((get-item $directory).FullName),'').substring(1) -split '\\')
|
||||
#$mydirectory.FullName
|
||||
$myparts.count
|
||||
for($i=0;$i -lt $myparts.count;$i++){
|
||||
$myparts[$i]=$myparts[$i] -replace ' ','_' -replace ':',''
|
||||
if(-not($global:taghash[$myparts[$i]])){
|
||||
if($myparts[$i] -eq ''){
|
||||
if($i -eq 0){
|
||||
write-host "Creating Tag $($myparts[$i])"
|
||||
new-tag -TagName $myparts[$i] -ParentTagName $AnchorTag
|
||||
} else{
|
||||
write-host "Creating Tag $($myparts[$i])"
|
||||
new-tag -TagName $myparts[$i] -ParentTagName $myparts[$i-1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(-not $OnlyCreateTags){
|
||||
if($AddAllDirsAsTags){
|
||||
foreach($part in $myparts){
|
||||
if($part.length -gt 36){
|
||||
$specialtags += $part.substring(0,36) -replace ' ','_' -replace ':','_';
|
||||
} else {
|
||||
$specialtags += $part -replace ' ','_' -replace ':','_';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(($myparts.count -gt 0) -and ($myparts[-1].length -gt 36)){
|
||||
$specialtags += $myparts[-1].substring(0,36) -replace ' ','_' -replace ':','_';
|
||||
} else {
|
||||
$specialtags += $myparts[-1] -replace ' ','_' -replace ':','_';
|
||||
}
|
||||
}
|
||||
$files = @(get-childitem -Path $mydirectory.FullName -File | select-object -ExpandProperty FullName | sort-object )
|
||||
if($files.count -gt 0){
|
||||
if((split-path $files[0] -parent) -eq (get-item $Directory).fullname){
|
||||
#write-host "1"
|
||||
#$mydirectory.FullName
|
||||
$title = $mydirectory.Name
|
||||
#write-host $title
|
||||
#write-host "MainFolder"
|
||||
$tagstoadd=@($AnchorTag,$tags,$importbatchtag)
|
||||
New-Document -title $title -tags $tagstoadd -file $files
|
||||
} else {
|
||||
#write-host "2"
|
||||
#write-host $title
|
||||
#$mydirectory.FullName
|
||||
$title = ($mydirectory.FullName -replace "$([Regex]::Escape($directory))","").Substring(1)
|
||||
#write-host $title
|
||||
#write-host "Subfolder"
|
||||
$tagstoadd = @($tags,$importbatchtag,$specialtags)
|
||||
New-Document -title $title -tags $tagstoadd -file $files
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} #End of "Should Process"
|
||||
}
|
43
PSTeedy/Public/New-TeedyDocument.ps1
Normal file
43
PSTeedy/Public/New-TeedyDocument.ps1
Normal file
@ -0,0 +1,43 @@
|
||||
function New-TeedyDocument(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
$title,
|
||||
$language='eng',
|
||||
$tags,
|
||||
$file
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
update-taghash
|
||||
$mytags=@()
|
||||
foreach($mytag in @($tags)){
|
||||
if($null -eq $mytag -or $mytag -eq ''){continue}
|
||||
try{
|
||||
|
||||
if($global:taghash[$mytag]){
|
||||
$mytags += $global:taghash[$mytag].id
|
||||
}
|
||||
} catch {
|
||||
write-host "Tag `'$mytag`' not found"
|
||||
write-host $tags
|
||||
throw
|
||||
}
|
||||
}
|
||||
#write-host "title"
|
||||
#write-host $title
|
||||
$title=[System.Web.HttpUtility]::UrlEncode($title)
|
||||
if($title.Length -lt 1){
|
||||
write-host "Title is blank. Stopping"
|
||||
throw
|
||||
}
|
||||
$basequery = "title=$title&language=$language"
|
||||
if ($tags) { $tagsquery = '&tags={0}' -f ($mytags -join '&tags=') }
|
||||
write-host $basequery
|
||||
write-host $tagsquery
|
||||
$newdocid = (Invoke-RestMethod -uri "$siteurl/api/document" -Headers $headers -Method PUT -body "$($basequery)$($tagsquery)" -ContentType 'application/x-www-form-urlencoded' -WebSession $global:loginsession).id
|
||||
if($file){
|
||||
$fileids= Add-File -Files $file
|
||||
attach-file -documentid $newdocid -fileid $fileids
|
||||
}
|
||||
$newdocid
|
||||
}
|
||||
}
|
42
PSTeedy/Public/New-TeedyFile.ps1
Normal file
42
PSTeedy/Public/New-TeedyFile.ps1
Normal file
@ -0,0 +1,42 @@
|
||||
Function New-TeedyFile(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
$Files
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
$fileids = @()
|
||||
foreach($file in $files){
|
||||
if(test-path $file){
|
||||
#upload the adamn file
|
||||
$toupload = get-item $file
|
||||
$fileids += (Invoke-RestMethod -uri "$siteurl/api/file" -Headers $headers -Method PUT -form @{file=$toupload} -ContentType "multipart/form-data" -WebSession $global:loginsession).id
|
||||
write-host $script:ExtractMSG
|
||||
if($script:ExtractMSG -eq $true){
|
||||
if($toupload.extension -eq '.msg'){
|
||||
#get data to a text file
|
||||
$msgdatafilepath="$($toupload.FullName).txt"
|
||||
if(-not(test-path "$msgdatafilepath")){
|
||||
try{
|
||||
copy-item $toupload.FullName -Destination "$($env:TEMP)\$($toupload.name)"
|
||||
$Outlook = New-Object -ComObject Outlook.Application
|
||||
$Message = $Outlook.Session.OpenSharedItem("$($env:TEMP)\$($toupload.name)")
|
||||
$message | select-object receivedtime, Senton, cc, To, SUbject, Body | set-content $msgdatafilepath
|
||||
$message.close(1)
|
||||
$Message=$null
|
||||
remove-item "$($env:TEMP)\$($toupload.name)"
|
||||
}catch{
|
||||
write-host "had an issue with the file"
|
||||
write-host $error[0]
|
||||
"$($env:TEMP)\$($toupload.name)"
|
||||
}
|
||||
#start-sleep -seconds .1
|
||||
$msgdatafile = get-item $msgdatafilepath
|
||||
$fileids += (Invoke-RestMethod -uri "$siteurl/api/file" -Headers $headers -Method PUT -form @{file=$msgdatafile} -ContentType "multipart/form-data" -WebSession $global:loginsession).id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$fileids
|
||||
}s
|
||||
}
|
50
PSTeedy/Public/New-TeedyTag.ps1
Normal file
50
PSTeedy/Public/New-TeedyTag.ps1
Normal file
@ -0,0 +1,50 @@
|
||||
function New-TeedyTag(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
$TagName,
|
||||
$ParentTagName="",
|
||||
$color="3a87ad"
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
if($tagname.length -gt 36){
|
||||
$tagname = $tagname.substring(0,36)
|
||||
}
|
||||
try{
|
||||
if($color -eq "3a87ad"){
|
||||
$colorcode="$color"
|
||||
} else {
|
||||
$colorcode = ("{0:X}" -f [drawing.Color]::FromName($color).toargb()).Substring(2)
|
||||
}
|
||||
}catch{
|
||||
$error[0]
|
||||
write-host "Unable to determine color code. Using default blue."
|
||||
$colorcode = '3a87ad'
|
||||
}
|
||||
Update-TagHash
|
||||
try{
|
||||
if($global:taghash[$TagName]){
|
||||
return "TAG $tagname already exists."
|
||||
}
|
||||
if((-not($global:taghash[$ParentTagName])) -and ($ParentTagName -ne '') ){
|
||||
$parentTagID = (New-Tag -TagName $ParentTagName -ParentTagName '').id
|
||||
} else{
|
||||
if($ParentTagName -eq ''){
|
||||
$parentTagID=''
|
||||
} else {
|
||||
$parentTagID=$global:taghash[$ParentTagName].id
|
||||
}
|
||||
}
|
||||
$mytagtocreate = @{
|
||||
name=$TagName -replace ' ','_' -replace ':','_';
|
||||
parent=$parentTagID;
|
||||
color="#$colorcode";
|
||||
}
|
||||
#$mytagtocreate
|
||||
$newtagid = Invoke-RestMethod -uri "$siteurl/api/tag" -Headers $headers -Method PUT -body $mytagtocreate -ContentType 'application/x-www-form-urlencoded' -WebSession $global:loginsession
|
||||
Update-TagHash
|
||||
} catch {
|
||||
$error[0]
|
||||
}
|
||||
$newtagid.idz
|
||||
}
|
||||
}
|
19
PSTeedy/Public/Remove-TeedyDocument.ps1
Normal file
19
PSTeedy/Public/Remove-TeedyDocument.ps1
Normal file
@ -0,0 +1,19 @@
|
||||
function Remove-TeedyDocument(){
|
||||
[CmdletBinding(DefaultParameterSetName='DocumentID',SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[Parameter(Mandatory=$true,ParameterSetName='DocumentID', Position=0)]
|
||||
[string]$DocumentID,
|
||||
[Parameter(Mandatory=$false,ParameterSetName='All', Position=0)]
|
||||
[switch]$All
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
If($All)
|
||||
{
|
||||
Get-TeedyTagByPartialName -TagPartialName "IMPORT*" | foreach-object {Remove-DocumentsByTag -Tag $_ -RemoveTagWhenComplete}
|
||||
}
|
||||
elseif ($DocumentID)
|
||||
{
|
||||
Invoke-RestMethod -uri "$siteurl/api/document/$DocumentID" -Headers $headers -body @{id=$documentId} -Method DELETE -WebSession $global:loginsession
|
||||
}
|
||||
}
|
||||
}
|
21
PSTeedy/Public/Remove-TeedyDocumentsByTag.ps1
Normal file
21
PSTeedy/Public/Remove-TeedyDocumentsByTag.ps1
Normal file
@ -0,0 +1,21 @@
|
||||
function Remove-TeedyDocumentsByTag(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
$Tag,
|
||||
[switch]$RemoveTagWhenComplete
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
update-taghash
|
||||
if(-not($global:taghash[$tag])){
|
||||
write-host "Tag $tag not found."
|
||||
break
|
||||
}
|
||||
$docstoremove=Invoke-RestMethod -uri "$siteurl/api/document/list" -Headers $headers -Method GET -Body @{search="tag:$Tag";limit=0 } -WebSession $global:loginsession| select-object -ExpandProperty documents|select-object -ExpandProperty id
|
||||
foreach($document in $docstoremove){
|
||||
remove-document -DocumentID $document
|
||||
}
|
||||
if($RemoveTagWhenComplete){
|
||||
Remove-TagByName -TagName $tag
|
||||
}
|
||||
}
|
||||
}
|
10
PSTeedy/Public/Remove-TeedyImportedDocs.ps1
Normal file
10
PSTeedy/Public/Remove-TeedyImportedDocs.ps1
Normal file
@ -0,0 +1,10 @@
|
||||
function Remove-TeedyAllImportedDocs(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[String]$Name = "IMPORT*"
|
||||
)
|
||||
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
get-TagByPartialName -tagPartialName $Name | foreach-object {Remove-DocumentsByTag -Tag $_ -RemoveTagWhenComplete}
|
||||
}
|
||||
}
|
16
PSTeedy/Public/Remove-TeedyTagByID.ps1
Normal file
16
PSTeedy/Public/Remove-TeedyTagByID.ps1
Normal file
@ -0,0 +1,16 @@
|
||||
function Remove-TeedyTagById(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[parameter(mandatory)][string]$TagID
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
if($global:taghash[$tagid].id){
|
||||
$result = Invoke-RestMethod -uri "$siteurl/api/tag/$tagid" -Headers $headers -Method DELETE -WebSession $global:loginsession
|
||||
Update-TagHash
|
||||
} else {
|
||||
$result = "$tagid not found"
|
||||
#continue
|
||||
}
|
||||
$result
|
||||
}
|
||||
}
|
17
PSTeedy/Public/Remove-TeedyTagByName.ps1
Normal file
17
PSTeedy/Public/Remove-TeedyTagByName.ps1
Normal file
@ -0,0 +1,17 @@
|
||||
function Remove-TeedyTagByName(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[parameter(mandatory)][string]$TagName
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
$tagid = $global:taghash[$tagname].id
|
||||
if($tagid){
|
||||
$result = Invoke-RestMethod -uri "$siteurl/api/tag/$tagid" -Headers $headers -Method DELETE -WebSession $global:loginsession
|
||||
Update-TagHash
|
||||
} else {
|
||||
$result = "$tagname not found"
|
||||
#continue
|
||||
}
|
||||
$result
|
||||
}
|
||||
}
|
16
PSTeedy/Public/Remove-TeedyTagByPartialName.ps1
Normal file
16
PSTeedy/Public/Remove-TeedyTagByPartialName.ps1
Normal file
@ -0,0 +1,16 @@
|
||||
function Remove-TeedyTagByPartialName(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[parameter(mandatory)]$TagPartialName
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
$tagstoremove = @($global:taghash.keys | where-object {$_ -like $tagpartialname})
|
||||
if($tagstoremove.count -eq 0){
|
||||
write-host "No tags found."
|
||||
break
|
||||
}
|
||||
foreach($tag in $tagstoremove){
|
||||
remove-tagbyid -tagid $tag
|
||||
}
|
||||
}
|
||||
}
|
37
PSTeedy/Public/Update-TeedyTag.ps1
Normal file
37
PSTeedy/Public/Update-TeedyTag.ps1
Normal file
@ -0,0 +1,37 @@
|
||||
function Update-TeedyTag(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[parameter(Mandatory)][string]$TagName,
|
||||
[parameter()][string]$ParentTagName,
|
||||
[parameter()][string]$Color
|
||||
)
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
update-taghash
|
||||
if($global:taghash[$TagName]){
|
||||
$mytag = $global:taghash[$tagname]
|
||||
if($color){
|
||||
try{
|
||||
$colorcode = ("{0:X}" -f [drawing.Color]::FromName($color).toargb() ).Substring(2)
|
||||
$mytag.color = "#$colorcode"
|
||||
} catch{
|
||||
$error[0]
|
||||
write-host "Color $color not found, not changing"
|
||||
}
|
||||
}
|
||||
if($global:taghash[$ParentTagName]){
|
||||
$mytag.parent = $global:taghash[$ParentTagName].id
|
||||
}
|
||||
$tagid=$mytag.id
|
||||
$mytag
|
||||
$topost=@{
|
||||
name=$mytag.name;
|
||||
id=$mytag.id;
|
||||
parent=$mytag.parent;
|
||||
color=$mytag.Color
|
||||
}
|
||||
Invoke-RestMethod -uri "$siteurl/api/tag/$tagid" -Headers $headers -Method POST -Body $topost -ContentType 'application/x-www-form-urlencoded' -WebSession $global:loginsession
|
||||
} else {
|
||||
write-host "$tagname not found"
|
||||
}
|
||||
}
|
||||
}
|
38
PSTeedy/Public/Update-TeedyTagHash.ps1
Normal file
38
PSTeedy/Public/Update-TeedyTagHash.ps1
Normal file
@ -0,0 +1,38 @@
|
||||
function Update-TeedyTagHash(){
|
||||
[CmdletBinding(SupportsShouldProcess=$true)]
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[String]$TagList
|
||||
)
|
||||
|
||||
If($PSCmdlet.ShouldProcess("$FileID", "Adding a file to Teedy")) {
|
||||
$taglist = Invoke-RestMethod -uri "$siteurl/api/tag/list" -Headers $headers -Method GET -WebSession $global:loginsession| select-object -ExpandProperty tags
|
||||
$global:taghash=@{}
|
||||
foreach($tag in $taglist){
|
||||
try{
|
||||
if($taghash[$tag.name]){
|
||||
write-host
|
||||
write-host @"
|
||||
"ERROR: Duplicate Tag Detected."
|
||||
This tag:
|
||||
ID=$($tag.id)
|
||||
Name=$($tag.name)
|
||||
Parent=$($tag.parent)
|
||||
Color=$($tag.color)
|
||||
|
||||
Existing Tag
|
||||
ID=$($taghash[$tag.name].id)
|
||||
Name=$($taghash[$tag.name].name)
|
||||
Parent=$($taghash[$tag.name].parent)
|
||||
Color=$($taghash[$tag.name].color)
|
||||
"@
|
||||
continue
|
||||
}
|
||||
$global:taghash.add($tag.name, @{ID=$tag.id;Name=$tag.name;Parent=$tag.parent;Color=$tag.color})
|
||||
$global:taghash.add($tag.id, @{ID=$tag.id;Name=$tag.name;Parent=$tag.parent;Color=$tag.color})
|
||||
} catch {
|
||||
Write-host $error[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
README.md
37
README.md
@ -1,2 +1,39 @@
|
||||
# PSTeedy
|
||||
|
||||
Powershell Module for interfacing with Teedy from Teedy.io
|
||||
|
||||
## Overview
|
||||
|
||||
PSTeedy is a PowerShell module for interfacing with a Teedy instance. You can create or remove folders, files and tags.
|
||||
|
||||
| :exclamation: Important |
|
||||
|-----------------------------------------|
|
||||
| This module is under heavy development. For a stable script, use [this](https://github.com/paradizelost/Powershell-Public/blob/master/teedy.ps1) |
|
||||
|
||||
## Installation
|
||||
|
||||
Download the repository and copy to your PowerShell modules path
|
||||
|
||||
```PowerShell
|
||||
C:\User\Documents\WindowsPowerShell\Modules
|
||||
```
|
||||
|
||||
You can install PSTeedy from the PowerShell gallery using the below command.
|
||||
|
||||
```PowerShell
|
||||
PS C:\> Install-Module PSTeedy -Scope Currentuser
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
```PowerShell
|
||||
PS C:\> Connect-Teedy -Username "Admin" -Password "Admin" -URL "https://demo.teedy.io"
|
||||
```
|
||||
|
||||
The above example connects to a Teedy instance hosted at "https://demo.teedy.io" using the username and password of "Admin"
|
||||
|
||||
```PowerShell
|
||||
PS C:\> New-TeedyDirectory -Directory "C:\Docs\" -AnchorTag "Upload Test" -Tags "Expenses", "Internal" -ExtractMsgFiles
|
||||
```
|
||||
|
||||
The above example will mimic the directory structure under "C:\Docs" and extract attachments from .msg files.
|
||||
|
44
build.ps1
Normal file
44
build.ps1
Normal file
@ -0,0 +1,44 @@
|
||||
[cmdletbinding(DefaultParameterSetName = 'Task')]
|
||||
param(
|
||||
# Build task(s) to execute
|
||||
[parameter(ParameterSetName = 'task', position = 0)]
|
||||
[string[]]$Task = 'default',
|
||||
|
||||
# Bootstrap dependencies
|
||||
[switch]$Bootstrap,
|
||||
|
||||
# List available build tasks
|
||||
[parameter(ParameterSetName = 'Help')]
|
||||
[switch]$Help,
|
||||
|
||||
# Optional properties to pass to psake
|
||||
[hashtable]$Properties
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# Bootstrap dependencies
|
||||
if ($Bootstrap.IsPresent) {
|
||||
Get-PackageProvider -Name Nuget -ForceBootstrap | Out-Null
|
||||
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
|
||||
if ((Test-Path -Path ./requirements.psd1)) {
|
||||
if (-not (Get-Module -Name PSDepend -ListAvailable)) {
|
||||
Install-Module -Name PSDepend -Repository PSGallery -Scope CurrentUser -Force
|
||||
}
|
||||
Import-Module -Name PSDepend -Verbose:$false
|
||||
Invoke-PSDepend -Path './requirements.psd1' -Install -Import -Force -WarningAction SilentlyContinue
|
||||
} else {
|
||||
Write-Warning "No [requirements.psd1] found. Skipping build dependency installation."
|
||||
}
|
||||
}
|
||||
|
||||
# Execute psake task(s)
|
||||
$psakeFile = './psakeFile.ps1'
|
||||
if ($PSCmdlet.ParameterSetName -eq 'Help') {
|
||||
Get-PSakeScriptTasks -buildFile $psakeFile |
|
||||
Format-Table -Property Name, Description, Alias, DependsOn
|
||||
} else {
|
||||
Set-BuildEnvironment -Force
|
||||
Invoke-psake -buildFile $psakeFile -taskList $Task -nologo -properties $Properties
|
||||
exit ([int](-not $psake.build_success))
|
||||
}
|
106
docs/Add-TeedyFile.md
Normal file
106
docs/Add-TeedyFile.md
Normal file
@ -0,0 +1,106 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Add-TeedyFile
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Add-TeedyFile [[-DocumentID] <String[]>] [[-FileID] <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -DocumentID
|
||||
{{ Fill DocumentID Description }}
|
||||
|
||||
```yaml
|
||||
Type: String[]
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -FileID
|
||||
{{ Fill FileID Description }}
|
||||
|
||||
```yaml
|
||||
Type: String[]
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
132
docs/Connect-Teedy.md
Normal file
132
docs/Connect-Teedy.md
Normal file
@ -0,0 +1,132 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Connect-Teedy
|
||||
|
||||
## SYNOPSIS
|
||||
|
||||
Connect to a teedy instance using a username and password.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```PowerShell
|
||||
Connect-Teedy [-Username] <String> [-Password] <String> [-URL] <String> [-WhatIf] [-Confirm]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
||||
Connect to a teedy instance using a username and password.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
|
||||
```powershell
|
||||
PS C:\> Connect-Teedy -Username "Admin" -Password "Admin" -URL "https://demo.teedy.io"
|
||||
```
|
||||
|
||||
The above example connects to a Teedy instance hosted at "https://demo.teedy.io" using the username and password of "Admin"
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Password
|
||||
|
||||
The password for the user to access the Teedy instance.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -URL
|
||||
|
||||
The URL of the Teedy instance you would like to connect to.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Username
|
||||
|
||||
The username to access the Teedy instance with
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
91
docs/Get-TeedyDocumentByTag.md
Normal file
91
docs/Get-TeedyDocumentByTag.md
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Get-TeedyDocumentByTag
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Get-TeedyDocumentByTag [-Tag] <Object> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Tag
|
||||
{{ Fill Tag Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
91
docs/Get-TeedyDocumentTags.md
Normal file
91
docs/Get-TeedyDocumentTags.md
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Get-TeedyDocumentTags
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Get-TeedyDocumentTags [-documentid] <Object> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -documentid
|
||||
{{ Fill documentid Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
91
docs/Get-TeedyTagByPartialName.md
Normal file
91
docs/Get-TeedyTagByPartialName.md
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Get-TeedyTagByPartialName
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Get-TeedyTagByPartialName [-tagPartialName] <Object> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -tagPartialName
|
||||
{{ Fill tagPartialName Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
182
docs/New-TeedyDirectory.md
Normal file
182
docs/New-TeedyDirectory.md
Normal file
@ -0,0 +1,182 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# New-TeedyDirectory
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
New-TeedyDirectory [[-AnchorTag] <Object>] [[-Directory] <Object>] [-DontUseExistingTags] [-OnlyCreateTags]
|
||||
[-AddAllDirsAsTags] [-ExractMSGFiles] [[-Tags] <Object>] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -AddAllDirsAsTags
|
||||
{{ Fill AddAllDirsAsTags Description }}
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -AnchorTag
|
||||
{{ Fill AnchorTag Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Directory
|
||||
{{ Fill Directory Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -DontUseExistingTags
|
||||
{{ Fill DontUseExistingTags Description }}
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -ExractMSGFiles
|
||||
{{ Fill ExractMSGFiles Description }}
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -OnlyCreateTags
|
||||
{{ Fill OnlyCreateTags Description }}
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Tags
|
||||
{{ Fill Tags Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
137
docs/New-TeedyDocument.md
Normal file
137
docs/New-TeedyDocument.md
Normal file
@ -0,0 +1,137 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# New-TeedyDocument
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
New-TeedyDocument [[-title] <Object>] [[-language] <Object>] [[-tags] <Object>] [[-file] <Object>] [-WhatIf]
|
||||
[-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -file
|
||||
{{ Fill file Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 3
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -language
|
||||
{{ Fill language Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -tags
|
||||
{{ Fill tags Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -title
|
||||
{{ Fill title Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
91
docs/New-TeedyFile.md
Normal file
91
docs/New-TeedyFile.md
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# New-TeedyFile
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
New-TeedyFile [[-Files] <Object>] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Files
|
||||
{{ Fill Files Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
122
docs/New-TeedyTag.md
Normal file
122
docs/New-TeedyTag.md
Normal file
@ -0,0 +1,122 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# New-TeedyTag
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
New-TeedyTag [[-TagName] <Object>] [[-ParentTagName] <Object>] [[-color] <Object>] [-WhatIf] [-Confirm]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -ParentTagName
|
||||
{{ Fill ParentTagName Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TagName
|
||||
{{ Fill TagName Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -color
|
||||
{{ Fill color Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
112
docs/Remove-TeedyDocument.md
Normal file
112
docs/Remove-TeedyDocument.md
Normal file
@ -0,0 +1,112 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Remove-TeedyDocument
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
### DocumentID (Default)
|
||||
```
|
||||
Remove-TeedyDocument [-DocumentID] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### All
|
||||
```
|
||||
Remove-TeedyDocument [-All] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -All
|
||||
{{ Fill All Description }}
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: All
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -DocumentID
|
||||
{{ Fill DocumentID Description }}
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: DocumentID
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
106
docs/Remove-TeedyDocumentsByTag.md
Normal file
106
docs/Remove-TeedyDocumentsByTag.md
Normal file
@ -0,0 +1,106 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Remove-TeedyDocumentsByTag
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Remove-TeedyDocumentsByTag [[-Tag] <Object>] [-RemoveTagWhenComplete] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -RemoveTagWhenComplete
|
||||
{{ Fill RemoveTagWhenComplete Description }}
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Tag
|
||||
{{ Fill Tag Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
91
docs/Remove-TeedyTagById.md
Normal file
91
docs/Remove-TeedyTagById.md
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Remove-TeedyTagById
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Remove-TeedyTagById [-TagID] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TagID
|
||||
{{ Fill TagID Description }}
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
91
docs/Remove-TeedyTagByName.md
Normal file
91
docs/Remove-TeedyTagByName.md
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Remove-TeedyTagByName
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Remove-TeedyTagByName [-TagName] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TagName
|
||||
{{ Fill TagName Description }}
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
91
docs/Remove-TeedyTagByPartialName.md
Normal file
91
docs/Remove-TeedyTagByPartialName.md
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Remove-TeedyTagByPartialName
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Remove-TeedyTagByPartialName [-TagPartialName] <Object> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TagPartialName
|
||||
{{ Fill TagPartialName Description }}
|
||||
|
||||
```yaml
|
||||
Type: Object
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
122
docs/Update-TeedyTag.md
Normal file
122
docs/Update-TeedyTag.md
Normal file
@ -0,0 +1,122 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Update-TeedyTag
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Update-TeedyTag [-TagName] <String> [[-ParentTagName] <String>] [[-Color] <String>] [-WhatIf] [-Confirm]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Color
|
||||
{{ Fill Color Description }}
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -ParentTagName
|
||||
{{ Fill ParentTagName Description }}
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TagName
|
||||
{{ Fill TagName Description }}
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
91
docs/Update-TeedyTagHash.md
Normal file
91
docs/Update-TeedyTagHash.md
Normal file
@ -0,0 +1,91 @@
|
||||
---
|
||||
external help file: PSTeedy-help.xml
|
||||
Module Name: PSTeedy
|
||||
online version:
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Update-TeedyTagHash
|
||||
|
||||
## SYNOPSIS
|
||||
{{ Fill in the Synopsis }}
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Update-TeedyTagHash [-TagList] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
{{ Fill in the Description }}
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> {{ Add example code here }}
|
||||
```
|
||||
|
||||
{{ Add example description here }}
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TagList
|
||||
{{ Fill TagList Description }}
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
59
docs/en-US/about_PSTeedy.help.md
Normal file
59
docs/en-US/about_PSTeedy.help.md
Normal file
@ -0,0 +1,59 @@
|
||||
# PSTeedy
|
||||
|
||||
## about_PSTeedy
|
||||
|
||||
```
|
||||
ABOUT TOPIC NOTE:
|
||||
The first header of the about topic should be the topic name.
|
||||
The second header contains the lookup name used by the help system.
|
||||
|
||||
IE:
|
||||
# Some Help Topic Name
|
||||
## SomeHelpTopicFileName
|
||||
|
||||
This will be transformed into the text file
|
||||
as `about_SomeHelpTopicFileName`.
|
||||
Do not include file extensions.
|
||||
The second header should have no spaces.
|
||||
```
|
||||
|
||||
# SHORT DESCRIPTION
|
||||
{{ Short Description Placeholder }}
|
||||
|
||||
```
|
||||
ABOUT TOPIC NOTE:
|
||||
About topics can be no longer than 80 characters wide when rendered to text.
|
||||
Any topics greater than 80 characters will be automatically wrapped.
|
||||
The generated about topic will be encoded UTF-8.
|
||||
```
|
||||
|
||||
# LONG DESCRIPTION
|
||||
{{ Long Description Placeholder }}
|
||||
|
||||
## Optional Subtopics
|
||||
{{ Optional Subtopic Placeholder }}
|
||||
|
||||
# EXAMPLES
|
||||
{{ Code or descriptive examples of how to leverage the functions described. }}
|
||||
|
||||
# NOTE
|
||||
{{ Note Placeholder - Additional information that a user needs to know.}}
|
||||
|
||||
# TROUBLESHOOTING NOTE
|
||||
{{ Troubleshooting Placeholder - Warns users of bugs}}
|
||||
|
||||
{{ Explains behavior that is likely to change with fixes }}
|
||||
|
||||
# SEE ALSO
|
||||
{{ See also placeholder }}
|
||||
|
||||
{{ You can also list related articles, blogs, and video URLs. }}
|
||||
|
||||
# KEYWORDS
|
||||
{{List alternate names or titles for this topic that readers might use.}}
|
||||
|
||||
- {{ Keyword Placeholder }}
|
||||
- {{ Keyword Placeholder }}
|
||||
- {{ Keyword Placeholder }}
|
||||
- {{ Keyword Placeholder }}
|
||||
|
10
psakeFile.ps1
Normal file
10
psakeFile.ps1
Normal file
@ -0,0 +1,10 @@
|
||||
properties {
|
||||
# Disable "compiling" module into monolithinc PSM1.
|
||||
# This modifies the default behavior from the "Build" task
|
||||
# in the PowerShellBuild shared psake task module
|
||||
$PSBPreference.Build.CompileModule = $false
|
||||
}
|
||||
|
||||
task default -depends Test
|
||||
|
||||
task Test -FromModule PowerShellBuild -Version '0.4.0'
|
20
requirements.psd1
Normal file
20
requirements.psd1
Normal file
@ -0,0 +1,20 @@
|
||||
@{
|
||||
PSDependOptions = @{
|
||||
Target = 'CurrentUser'
|
||||
}
|
||||
'Pester' = @{
|
||||
Version = '4.9.0'
|
||||
Parameters = @{
|
||||
SkipPublisherCheck = $true
|
||||
}
|
||||
}
|
||||
'psake' = @{
|
||||
Version = '4.8.0'
|
||||
}
|
||||
'BuildHelpers' = @{
|
||||
Version = '2.0.11'
|
||||
}
|
||||
'PowerShellBuild' = @{
|
||||
Version = '0.4.0'
|
||||
}
|
||||
}
|
432
teedy.ps1
432
teedy.ps1
@ -1,432 +0,0 @@
|
||||
function get-sitelogin(){
|
||||
param(
|
||||
$username='demo',
|
||||
$Password='password',
|
||||
$URL='https://demo.teedy.io'
|
||||
)
|
||||
$global:siteurl=$URL
|
||||
$tologin=@{username="$username";password="$password";}
|
||||
try{
|
||||
$loginresponse = Invoke-webrequest -Uri "$siteurl/api/user/login" -Method POST -Body $tologin -SessionVariable Session
|
||||
} catch {
|
||||
if(($error[0].ErrorDetails.Message|convertfrom-json|select-object -ExpandProperty Type) -eq 'ValidationCodeRequired'){
|
||||
$mfacode = read-host "MFA Code Required for user. Please enter MFA Code:"
|
||||
if($mfacode -match '\d{6}'){
|
||||
$tologin.add('code',$mfacode)
|
||||
$loginresponse = Invoke-webrequest -Uri "$siteurl/api/user/login" -Method POST -Body $tologin -SessionVariable Session
|
||||
}
|
||||
}
|
||||
}
|
||||
if($loginresponse.baseresponse.StatusCode -eq 200){
|
||||
write-host "Logged in successfully"
|
||||
}
|
||||
$global:loginsession = $session
|
||||
$headercookie = ($loginresponse|select-object -ExpandProperty Headers)["Set-Cookie"]
|
||||
$token,$null = $headercookie -split ";"
|
||||
$headers=@{
|
||||
Cookie = "$token"
|
||||
}
|
||||
return $headers
|
||||
}
|
||||
function New-Tag(){
|
||||
param(
|
||||
$TagName,
|
||||
$ParentTagName="",
|
||||
$color="3a87ad"
|
||||
)
|
||||
if($tagname.length -gt 36){
|
||||
$tagname = $tagname.substring(0,36)
|
||||
}
|
||||
try{
|
||||
if($color -eq "3a87ad"){
|
||||
$colorcode="$color"
|
||||
} else {
|
||||
$colorcode = ("{0:X}" -f [drawing.Color]::FromName($color).toargb()).Substring(2)
|
||||
}
|
||||
}catch{
|
||||
$error[0]
|
||||
write-host "Unable to determine color code. Using default blue."
|
||||
$colorcode = '3a87ad'
|
||||
}
|
||||
Update-TagHash
|
||||
try{
|
||||
if($global:taghash[$TagName]){
|
||||
return "TAG $tagname already exists."
|
||||
}
|
||||
if((-not($global:taghash[$ParentTagName])) -and ($ParentTagName -ne '') ){
|
||||
$parentTagID = (New-Tag -TagName $ParentTagName -ParentTagName '').id
|
||||
} else{
|
||||
if($ParentTagName -eq ''){
|
||||
$parentTagID=''
|
||||
} else {
|
||||
$parentTagID=$global:taghash[$ParentTagName].id
|
||||
}
|
||||
}
|
||||
$mytagtocreate = @{
|
||||
name=$TagName -replace ' ','_' -replace ':','_';
|
||||
parent=$parentTagID;
|
||||
color="#$colorcode";
|
||||
}
|
||||
#$mytagtocreate
|
||||
$newtagid = Invoke-RestMethod -uri "$siteurl/api/tag" -Headers $headers -Method PUT -body $mytagtocreate -ContentType 'application/x-www-form-urlencoded' -WebSession $global:loginsession
|
||||
Update-TagHash
|
||||
} catch {
|
||||
$error[0]
|
||||
}
|
||||
$newtagid.idz
|
||||
}
|
||||
function Remove-TagByName(){
|
||||
param(
|
||||
[parameter(mandatory)][string]$TagName
|
||||
)
|
||||
$tagid = $global:taghash[$tagname].id
|
||||
if($tagid){
|
||||
$result = Invoke-RestMethod -uri "$siteurl/api/tag/$tagid" -Headers $headers -Method DELETE -WebSession $global:loginsession
|
||||
Update-TagHash
|
||||
} else {
|
||||
$result = "$tagname not found"
|
||||
#continue
|
||||
}
|
||||
$result
|
||||
}
|
||||
function Remove-TagById(){
|
||||
param(
|
||||
[parameter(mandatory)][string]$TagID
|
||||
)
|
||||
if($global:taghash[$tagid].id){
|
||||
$result = Invoke-RestMethod -uri "$siteurl/api/tag/$tagid" -Headers $headers -Method DELETE -WebSession $global:loginsession
|
||||
Update-TagHash
|
||||
} else {
|
||||
$result = "$tagid not found"
|
||||
#continue
|
||||
}
|
||||
$result
|
||||
}
|
||||
function update-tag(){
|
||||
param(
|
||||
[parameter(Mandatory)][string]$TagName,
|
||||
[parameter()][string]$ParentTagName,
|
||||
[parameter()][string]$Color
|
||||
)
|
||||
update-taghash
|
||||
if($global:taghash[$TagName]){
|
||||
$mytag = $global:taghash[$tagname]
|
||||
if($color){
|
||||
try{
|
||||
$colorcode = ("{0:X}" -f [drawing.Color]::FromName($color).toargb() ).Substring(2)
|
||||
$mytag.color = "#$colorcode"
|
||||
} catch{
|
||||
$error[0]
|
||||
write-host "Color $color not found, not changing"
|
||||
}
|
||||
}
|
||||
if($global:taghash[$ParentTagName]){
|
||||
$mytag.parent = $global:taghash[$ParentTagName].id
|
||||
}
|
||||
$tagid=$mytag.id
|
||||
$mytag
|
||||
$topost=@{
|
||||
name=$mytag.name;
|
||||
id=$mytag.id;
|
||||
parent=$mytag.parent;
|
||||
color=$mytag.Color
|
||||
}
|
||||
Invoke-RestMethod -uri "$siteurl/api/tag/$tagid" -Headers $headers -Method POST -Body $topost -ContentType 'application/x-www-form-urlencoded' -WebSession $global:loginsession
|
||||
} else {
|
||||
write-host "$tagname not found"
|
||||
}
|
||||
}
|
||||
function Update-TagHash(){
|
||||
$taglist = Invoke-RestMethod -uri "$siteurl/api/tag/list" -Headers $headers -Method GET -WebSession $global:loginsession| select-object -ExpandProperty tags
|
||||
$global:taghash=@{}
|
||||
foreach($tag in $taglist){
|
||||
try{
|
||||
if($taghash[$tag.name]){
|
||||
write-host
|
||||
write-host @"
|
||||
"ERROR: Duplicate Tag Detected."
|
||||
This tag:
|
||||
ID=$($tag.id)
|
||||
Name=$($tag.name)
|
||||
Parent=$($tag.parent)
|
||||
Color=$($tag.color)
|
||||
|
||||
Existing Tag
|
||||
ID=$($taghash[$tag.name].id)
|
||||
Name=$($taghash[$tag.name].name)
|
||||
Parent=$($taghash[$tag.name].parent)
|
||||
Color=$($taghash[$tag.name].color)
|
||||
"@
|
||||
continue
|
||||
}
|
||||
$global:taghash.add($tag.name, @{ID=$tag.id;Name=$tag.name;Parent=$tag.parent;Color=$tag.color})
|
||||
$global:taghash.add($tag.id, @{ID=$tag.id;Name=$tag.name;Parent=$tag.parent;Color=$tag.color})
|
||||
} catch {
|
||||
Write-host $error[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
function Attach-File(){
|
||||
param(
|
||||
$documentID,
|
||||
$fileID
|
||||
)
|
||||
foreach($file in @($fileID)){
|
||||
foreach($document in @($documentID)){
|
||||
$toattach=@{
|
||||
fileID=$file;
|
||||
id=$document
|
||||
}
|
||||
Invoke-RestMethod -uri "$siteurl/api/file/$file/attach" -Headers $headers -Method POST -Body $toattach -ContentType 'application/x-www-form-urlencoded' -WebSession $global:loginsession
|
||||
}
|
||||
}
|
||||
}
|
||||
function New-Document(){
|
||||
param(
|
||||
$title,
|
||||
$language='eng',
|
||||
$tags,
|
||||
$file
|
||||
)
|
||||
update-taghash
|
||||
$mytags=@()
|
||||
foreach($mytag in @($tags)){
|
||||
if($null -eq $mytag -or $mytag -eq ''){continue}
|
||||
try{
|
||||
|
||||
if($global:taghash[$mytag]){
|
||||
$mytags += $global:taghash[$mytag].id
|
||||
}
|
||||
} catch {
|
||||
write-host "Tag `'$mytag`' not found"
|
||||
write-host $tags
|
||||
throw
|
||||
}
|
||||
}
|
||||
#write-host "title"
|
||||
#write-host $title
|
||||
$title=[System.Web.HttpUtility]::UrlEncode($title)
|
||||
if($title.Length -lt 1){
|
||||
write-host "Title is blank. Stopping"
|
||||
throw
|
||||
}
|
||||
$basequery = "title=$title&language=$language"
|
||||
if ($tags) { $tagsquery = '&tags={0}' -f ($mytags -join '&tags=') }
|
||||
write-host $basequery
|
||||
write-host $tagsquery
|
||||
$newdocid = (Invoke-RestMethod -uri "$siteurl/api/document" -Headers $headers -Method PUT -body "$($basequery)$($tagsquery)" -ContentType 'application/x-www-form-urlencoded' -WebSession $global:loginsession).id
|
||||
if($file){
|
||||
$fileids= Add-File -Files $file
|
||||
attach-file -documentid $newdocid -fileid $fileids
|
||||
}
|
||||
$newdocid
|
||||
}
|
||||
Function Add-File(){
|
||||
param(
|
||||
$Files
|
||||
)
|
||||
$fileids = @()
|
||||
foreach($file in $files){
|
||||
if(test-path $file){
|
||||
#upload the adamn file
|
||||
$toupload = get-item $file
|
||||
$fileids += (Invoke-RestMethod -uri "$siteurl/api/file" -Headers $headers -Method PUT -form @{file=$toupload} -ContentType "multipart/form-data" -WebSession $global:loginsession).id
|
||||
write-host $script:ExtractMSG
|
||||
if($script:ExtractMSG -eq $true){
|
||||
if($toupload.extension -eq '.msg'){
|
||||
#get data to a text file
|
||||
$msgdatafilepath="$($toupload.FullName).txt"
|
||||
if(-not(test-path "$msgdatafilepath")){
|
||||
try{
|
||||
copy-item $toupload.FullName -Destination "$($env:TEMP)\$($toupload.name)"
|
||||
$Outlook = New-Object -ComObject Outlook.Application
|
||||
$Message = $Outlook.Session.OpenSharedItem("$($env:TEMP)\$($toupload.name)")
|
||||
$message | select-object receivedtime, Senton, cc, To, SUbject, Body | set-content $msgdatafilepath
|
||||
$message.close(1)
|
||||
$Message=$null
|
||||
remove-item "$($env:TEMP)\$($toupload.name)"
|
||||
}catch{
|
||||
write-host "had an issue with the file"
|
||||
write-host $error[0]
|
||||
"$($env:TEMP)\$($toupload.name)"
|
||||
}
|
||||
#start-sleep -seconds .1
|
||||
$msgdatafile = get-item $msgdatafilepath
|
||||
$fileids += (Invoke-RestMethod -uri "$siteurl/api/file" -Headers $headers -Method PUT -form @{file=$msgdatafile} -ContentType "multipart/form-data" -WebSession $global:loginsession).id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$fileids
|
||||
}
|
||||
function Add-Directory(){
|
||||
param(
|
||||
$AnchorTag='DirUploadTest',
|
||||
$Directory='C:\Users\dan\teedytest',
|
||||
[switch]$DontUseExistingTags,
|
||||
[switch]$OnlyCreateTags,
|
||||
[switch]$AddAllDirsAsTags,
|
||||
[switch]$ExractMSGFiles,
|
||||
$Tags
|
||||
)
|
||||
if($ExractMSGFiles){
|
||||
$script:ExtractMSG=$true
|
||||
}
|
||||
if($directory[-1] -eq '\'){
|
||||
$directory = $directory.substring(0,$directory.length -1)
|
||||
}
|
||||
Update-TagHash
|
||||
if(-not($global:taghash[$AnchorTag])){
|
||||
new-tag -TagName $AnchorTag
|
||||
}
|
||||
$importbatchtag = "IMPORTBATCH-$(get-date -format yyyyMMddmmss)"
|
||||
new-tag -TagName $importbatchtag -ParentTagName $AnchorTag
|
||||
|
||||
$directories = @(get-childitem -Path $directory -Directory -Recurse)
|
||||
$directories += Get-item -path $directory
|
||||
$directories = $directories|sort-object
|
||||
foreach($mydirectory in $directories){
|
||||
$specialtags=@()
|
||||
if($mydirectory.FullName -eq $directory){
|
||||
$specialtags+=$AnchorTag
|
||||
}else{
|
||||
$myparts = @(($mydirectory.fullname -replace [regex]::escape((get-item $directory).FullName),'').substring(1) -split '\\')
|
||||
#$mydirectory.FullName
|
||||
$myparts.count
|
||||
for($i=0;$i -lt $myparts.count;$i++){
|
||||
$myparts[$i]=$myparts[$i] -replace ' ','_' -replace ':',''
|
||||
if(-not($global:taghash[$myparts[$i]])){
|
||||
if($myparts[$i] -eq ''){
|
||||
if($i -eq 0){
|
||||
write-host "Creating Tag $($myparts[$i])"
|
||||
new-tag -TagName $myparts[$i] -ParentTagName $AnchorTag
|
||||
} else{
|
||||
write-host "Creating Tag $($myparts[$i])"
|
||||
new-tag -TagName $myparts[$i] -ParentTagName $myparts[$i-1]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(-not $OnlyCreateTags){
|
||||
if($AddAllDirsAsTags){
|
||||
foreach($part in $myparts){
|
||||
if($part.length -gt 36){
|
||||
$specialtags += $part.substring(0,36) -replace ' ','_' -replace ':','_';
|
||||
} else {
|
||||
$specialtags += $part -replace ' ','_' -replace ':','_';
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(($myparts.count -gt 0) -and ($myparts[-1].length -gt 36)){
|
||||
$specialtags += $myparts[-1].substring(0,36) -replace ' ','_' -replace ':','_';
|
||||
} else {
|
||||
$specialtags += $myparts[-1] -replace ' ','_' -replace ':','_';
|
||||
}
|
||||
}
|
||||
$files = @(get-childitem -Path $mydirectory.FullName -File | select-object -ExpandProperty FullName | sort-object )
|
||||
if($files.count -gt 0){
|
||||
if((split-path $files[0] -parent) -eq (get-item $Directory).fullname){
|
||||
#write-host "1"
|
||||
#$mydirectory.FullName
|
||||
$title = $mydirectory.Name
|
||||
#write-host $title
|
||||
#write-host "MainFolder"
|
||||
$tagstoadd=@($AnchorTag,$tags,$importbatchtag)
|
||||
New-Document -title $title -tags $tagstoadd -file $files
|
||||
} else {
|
||||
#write-host "2"
|
||||
#write-host $title
|
||||
#$mydirectory.FullName
|
||||
$title = ($mydirectory.FullName -replace "$([Regex]::Escape($directory))","").Substring(1)
|
||||
#write-host $title
|
||||
#write-host "Subfolder"
|
||||
$tagstoadd = @($tags,$importbatchtag,$specialtags)
|
||||
New-Document -title $title -tags $tagstoadd -file $files
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function Remove-AllImportedDocs(){
|
||||
get-TagByPartialName -tagPartialName "IMPORT*" | foreach-object {Remove-DocumentsByTag -Tag $_ -RemoveTagWhenComplete}
|
||||
}
|
||||
function Remove-DocumentsByTag(){
|
||||
param(
|
||||
$Tag,
|
||||
[switch]$RemoveTagWhenComplete
|
||||
)
|
||||
update-taghash
|
||||
if(-not($global:taghash[$tag])){
|
||||
write-host "Tag $tag not found."
|
||||
break
|
||||
}
|
||||
$docstoremove=Invoke-RestMethod -uri "$siteurl/api/document/list" -Headers $headers -Method GET -Body @{search="tag:$Tag";limit=0 } -WebSession $global:loginsession| select-object -ExpandProperty documents|select-object -ExpandProperty id
|
||||
foreach($document in $docstoremove){
|
||||
remove-document -DocumentID $document
|
||||
}
|
||||
if($RemoveTagWhenComplete){
|
||||
Remove-TagByName -TagName $tag
|
||||
}
|
||||
}
|
||||
function Get-DocumentByTag(){
|
||||
param([parameter(mandatory)]$tag)
|
||||
update-taghash
|
||||
if(-not($global:taghash[$tag])){
|
||||
write-host "Tag $tag not found."
|
||||
break
|
||||
}
|
||||
$DocumentList=Invoke-RestMethod -uri "$siteurl/api/document/list" -Headers $headers -Method GET -Body @{search="tag:$Tag";limit=0 } -WebSession $global:loginsession| select-object -ExpandProperty documents|select-object -ExpandProperty id
|
||||
$DocumentList
|
||||
}
|
||||
function get-documenttags(){
|
||||
param(
|
||||
[parameter(mandatory)]$documentid
|
||||
)
|
||||
Invoke-RestMethod -uri "$siteurl/api/document/$DocumentID" -Headers $headers -body @{id=$documentId} -Method GET -WebSession $global:loginsession|select-object -ExpandProperty tags
|
||||
}
|
||||
function Remove-Document(){
|
||||
param([parameter(mandatory)]$DocumentID)
|
||||
#write-host "Would Delete $documentid"
|
||||
Invoke-RestMethod -uri "$siteurl/api/document/$DocumentID" -Headers $headers -body @{id=$documentId} -Method DELETE -WebSession $global:loginsession
|
||||
}
|
||||
function Remove-TagByPartialName(){
|
||||
param(
|
||||
[parameter(mandatory)]$TagPartialName
|
||||
)
|
||||
$tagstoremove = @($global:taghash.keys | where-object {$_ -like $tagpartialname})
|
||||
if($tagstoremove.count -eq 0){
|
||||
write-host "No tags found."
|
||||
break
|
||||
}
|
||||
foreach($tag in $tagstoremove){
|
||||
remove-tagbyid -tagid $tag
|
||||
}
|
||||
}
|
||||
function get-TagByPartialName(){
|
||||
param([parameter(mandatory)]$tagPartialName)
|
||||
Update-TagHash
|
||||
$global:taghash.keys|where-object {$_ -like $tagPartialName}
|
||||
}
|
||||
#$importdir = 'c:\documentstoimport'#read-host "Please specify the path to import into Teedy"
|
||||
#$anchortag = 'DocumentImport'#read-host "What is the anchor tag to import items under?"
|
||||
$global:headers = get-sitelogin
|
||||
$global:taghash=@{}
|
||||
$script:ExtractMSG=$false
|
||||
update-taghash
|
||||
|
||||
#$additionalTags = "Files,2020"#read-host "Any additional tags (comma separated)?"
|
||||
#$tagstoadd = $additionalTags -split ","
|
||||
#Add-Directory -AnchorTag $anchortag -Directory $importdir -tags $tagstoadd -AddAllDirsAsTags -ExractMSGFiles
|
||||
|
||||
#$documentlist = Invoke-RestMethod -uri "$siteurl/api/document/list" -Headers $headers -Method GET -WebSession $global:loginsession| select-object -ExpandProperty documents
|
||||
#if($documentlist){write-host "Got docs"}
|
||||
#$filelist = Invoke-RestMethod -uri "$siteurl/api/file/list" -Headers $headers -Method GET -WebSession $global:loginsession|Select-Object -ExpandProperty Files
|
||||
#if($filelist){write-host "Got files"}
|
||||
<#
|
||||
$logoutresponse = Invoke-webrequest -Uri "$siteurl/api/user/logout" -Headers $headers -Method POST -WebSession $global:loginsession
|
||||
if($logoutresponse.BaseResponse.StatusCode -eq 200){
|
||||
write-host "logged out successfully"
|
||||
}
|
||||
#>
|
108
tests/Help.tests.ps1
Normal file
108
tests/Help.tests.ps1
Normal file
@ -0,0 +1,108 @@
|
||||
|
||||
# Taken with love from @juneb_get_help (https://raw.githubusercontent.com/juneb/PesterTDD/master/Module.Help.Tests.ps1)
|
||||
|
||||
$outputDir = Join-Path -Path $ENV:BHProjectPath -ChildPath 'Output'
|
||||
$outputModDir = Join-Path -Path $outputDir -ChildPath $env:BHProjectName
|
||||
$manifest = Import-PowerShellDataFile -Path $env:BHPSModuleManifest
|
||||
$outputModVerDir = Join-Path -Path $outputModDir -ChildPath $manifest.ModuleVersion
|
||||
|
||||
# Get module commands
|
||||
# Remove all versions of the module from the session. Pester can't handle multiple versions.
|
||||
#Get-Module $env:BHProjectName | Remove-Module -Force
|
||||
Import-Module -Name (Join-Path -Path $outputModVerDir -ChildPath "$($env:BHProjectName).psd1") -Verbose:$false -ErrorAction Stop
|
||||
$commands = Get-Command -Module (Get-Module $env:BHProjectName) -CommandType Cmdlet, Function, Workflow # Not alias
|
||||
|
||||
## When testing help, remember that help is cached at the beginning of each session.
|
||||
## To test, restart session.
|
||||
|
||||
foreach ($command in $commands) {
|
||||
$commandName = $command.Name
|
||||
|
||||
# The module-qualified command fails on Microsoft.PowerShell.Archive cmdlets
|
||||
$help = Get-Help $commandName -ErrorAction SilentlyContinue
|
||||
|
||||
Describe "Test help for $commandName" {
|
||||
|
||||
# If help is not found, synopsis in auto-generated help is the syntax diagram
|
||||
It 'should not be auto-generated' {
|
||||
$help.Synopsis | Should Not BeLike '*`[`<CommonParameters`>`]*'
|
||||
}
|
||||
|
||||
# Should be a description for every function
|
||||
It "gets description for $commandName" {
|
||||
$help.Description | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
# Should be at least one example
|
||||
It "gets example code from $commandName" {
|
||||
($help.Examples.Example | Select-Object -First 1).Code | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
# Should be at least one example description
|
||||
It "gets example help from $commandName" {
|
||||
($help.Examples.Example.Remarks | Select-Object -First 1).Text | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
Context "Test parameter help for $commandName" {
|
||||
|
||||
$common = 'Debug', 'ErrorAction', 'ErrorVariable', 'InformationAction', 'InformationVariable', 'OutBuffer',
|
||||
'OutVariable', 'PipelineVariable', 'Verbose', 'WarningAction', 'WarningVariable', 'Confirm', 'Whatif'
|
||||
|
||||
$parameters = $command.ParameterSets.Parameters |
|
||||
Sort-Object -Property Name -Unique |
|
||||
Where-Object { $_.Name -notin $common }
|
||||
$parameterNames = $parameters.Name
|
||||
|
||||
## Without the filter, WhatIf and Confirm parameters are still flagged in "finds help parameter in code" test
|
||||
$helpParameters = $help.Parameters.Parameter |
|
||||
Where-Object { $_.Name -notin $common } |
|
||||
Sort-Object -Property Name -Unique
|
||||
$helpParameterNames = $helpParameters.Name
|
||||
|
||||
foreach ($parameter in $parameters) {
|
||||
$parameterName = $parameter.Name
|
||||
$parameterHelp = $help.parameters.parameter | Where-Object Name -EQ $parameterName
|
||||
|
||||
# Should be a description for every parameter
|
||||
It "gets help for parameter: $parameterName : in $commandName" {
|
||||
$parameterHelp.Description.Text | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
# Required value in Help should match IsMandatory property of parameter
|
||||
It "help for $parameterName parameter in $commandName has correct Mandatory value" {
|
||||
$codeMandatory = $parameter.IsMandatory.toString()
|
||||
$parameterHelp.Required | Should Be $codeMandatory
|
||||
}
|
||||
|
||||
# Parameter type in Help should match code
|
||||
# It "help for $commandName has correct parameter type for $parameterName" {
|
||||
# $codeType = $parameter.ParameterType.Name
|
||||
# # To avoid calling Trim method on a null object.
|
||||
# $helpType = if ($parameterHelp.parameterValue) { $parameterHelp.parameterValue.Trim() }
|
||||
# $helpType | Should be $codeType
|
||||
# }
|
||||
}
|
||||
|
||||
foreach ($helpParm in $HelpParameterNames) {
|
||||
# Shouldn't find extra parameters in help.
|
||||
It "finds help parameter in code: $helpParm" {
|
||||
$helpParm -in $parameterNames | Should Be $true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "Help Links should be Valid for $commandName" {
|
||||
$link = $help.relatedLinks.navigationLink.uri
|
||||
|
||||
foreach ($link in $links) {
|
||||
if ($link) {
|
||||
# Should have a valid uri if one is provided.
|
||||
it "[$link] should have 200 Status Code for $commandName" {
|
||||
$Results = Invoke-WebRequest -Uri $link -UseBasicParsing
|
||||
$Results.StatusCode | Should Be '200'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
86
tests/Manifest.tests.ps1
Normal file
86
tests/Manifest.tests.ps1
Normal file
@ -0,0 +1,86 @@
|
||||
|
||||
$moduleName = $env:BHProjectName
|
||||
$manifest = Import-PowerShellDataFile -Path $env:BHPSModuleManifest
|
||||
$outputDir = Join-Path -Path $ENV:BHProjectPath -ChildPath 'Output'
|
||||
$outputModDir = Join-Path -Path $outputDir -ChildPath $env:BHProjectName
|
||||
$outputModVerDir = Join-Path -Path $outputModDir -ChildPath $manifest.ModuleVersion
|
||||
$outputManifestPath = Join-Path -Path $outputModVerDir -Child "$($moduleName).psd1"
|
||||
$changelogPath = Join-Path -Path $env:BHProjectPath -Child 'CHANGELOG.md'
|
||||
|
||||
Describe 'Module manifest' {
|
||||
Context 'Validation' {
|
||||
|
||||
$script:manifest = $null
|
||||
|
||||
It 'has a valid manifest' {
|
||||
{
|
||||
$script:manifest = Test-ModuleManifest -Path $outputManifestPath -Verbose:$false -ErrorAction Stop -WarningAction SilentlyContinue
|
||||
} | Should Not Throw
|
||||
}
|
||||
|
||||
It 'has a valid name in the manifest' {
|
||||
$script:manifest.Name | Should Be $env:BHProjectName
|
||||
}
|
||||
|
||||
It 'has a valid root module' {
|
||||
$script:manifest.RootModule | Should Be "$($moduleName).psm1"
|
||||
}
|
||||
|
||||
It 'has a valid version in the manifest' {
|
||||
$script:manifest.Version -as [Version] | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'has a valid description' {
|
||||
$script:manifest.Description | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'has a valid author' {
|
||||
$script:manifest.Author | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'has a valid guid' {
|
||||
{
|
||||
[guid]::Parse($script:manifest.Guid)
|
||||
} | Should Not throw
|
||||
}
|
||||
|
||||
It 'has a valid copyright' {
|
||||
$script:manifest.CopyRight | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
$script:changelogVersion = $null
|
||||
It 'has a valid version in the changelog' {
|
||||
foreach ($line in (Get-Content $changelogPath)) {
|
||||
if ($line -match "^##\s\[(?<Version>(\d+\.){1,3}\d+)\]") {
|
||||
$script:changelogVersion = $matches.Version
|
||||
break
|
||||
}
|
||||
}
|
||||
$script:changelogVersion | Should Not BeNullOrEmpty
|
||||
$script:changelogVersion -as [Version] | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'changelog and manifest versions are the same' {
|
||||
$script:changelogVersion -as [Version] | Should be ( $script:manifest.Version -as [Version] )
|
||||
}
|
||||
|
||||
if (Get-Command git.exe -ErrorAction SilentlyContinue) {
|
||||
$script:tagVersion = $null
|
||||
It 'is tagged with a valid version' -skip {
|
||||
$thisCommit = git.exe log --decorate --oneline HEAD~1..HEAD
|
||||
|
||||
if ($thisCommit -match 'tag:\s*(\d+(?:\.\d+)*)') {
|
||||
$script:tagVersion = $matches[1]
|
||||
}
|
||||
|
||||
$script:tagVersion | Should Not BeNullOrEmpty
|
||||
$script:tagVersion -as [Version] | Should Not BeNullOrEmpty
|
||||
}
|
||||
|
||||
It 'all versions are the same' {
|
||||
$script:changelogVersion -as [Version] | Should be ( $script:manifest.Version -as [Version] )
|
||||
#$script:manifest.Version -as [Version] | Should be ( $script:tagVersion -as [Version] )
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
41
tests/Meta.tests.ps1
Normal file
41
tests/Meta.tests.ps1
Normal file
@ -0,0 +1,41 @@
|
||||
Set-StrictMode -Version latest
|
||||
|
||||
# Make sure MetaFixers.psm1 is loaded - it contains Get-TextFilesList
|
||||
Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath 'MetaFixers.psm1') -Verbose:$false -Force
|
||||
|
||||
$projectRoot = $ENV:BHProjectPath
|
||||
if(-not $projectRoot) {
|
||||
$projectRoot = $PSScriptRoot
|
||||
}
|
||||
|
||||
Describe 'Text files formatting' {
|
||||
|
||||
$allTextFiles = Get-TextFilesList $projectRoot
|
||||
|
||||
Context 'Files encoding' {
|
||||
It "Doesn't use Unicode encoding" {
|
||||
$unicodeFilesCount = 0
|
||||
$allTextFiles | Foreach-Object {
|
||||
if (Test-FileUnicode $_) {
|
||||
$unicodeFilesCount += 1
|
||||
Write-Warning "File $($_.FullName) contains 0x00 bytes. It's probably uses Unicode and need to be converted to UTF-8. Use Fixer 'Get-UnicodeFilesList `$pwd | ConvertTo-UTF8'."
|
||||
}
|
||||
}
|
||||
$unicodeFilesCount | Should -Be 0
|
||||
}
|
||||
}
|
||||
|
||||
Context 'Indentations' {
|
||||
It 'Uses spaces for indentation, not tabs' {
|
||||
$totalTabsCount = 0
|
||||
$allTextFiles | Foreach-Object {
|
||||
$fileName = $_.FullName
|
||||
(Get-Content $_.FullName -Raw) | Select-String "`t" | Foreach-Object {
|
||||
Write-Warning "There are tab in $fileName. Use Fixer 'Get-TextFilesList `$pwd | ConvertTo-SpaceIndentation'."
|
||||
$totalTabsCount++
|
||||
}
|
||||
}
|
||||
$totalTabsCount | Should -Be 0
|
||||
}
|
||||
}
|
||||
}
|
75
tests/MetaFixers.psm1
Normal file
75
tests/MetaFixers.psm1
Normal file
@ -0,0 +1,75 @@
|
||||
# Taken with love from https://github.com/PowerShell/DscResource.Tests/blob/master/MetaFixers.psm1
|
||||
|
||||
<#
|
||||
This module helps fix problems, found by Meta.Tests.ps1
|
||||
#>
|
||||
|
||||
$ErrorActionPreference = 'stop'
|
||||
Set-StrictMode -Version latest
|
||||
|
||||
function ConvertTo-UTF8() {
|
||||
[CmdletBinding()]
|
||||
[OutputType([void])]
|
||||
param(
|
||||
[Parameter(Mandatory, ValueFromPipeline)]
|
||||
[System.IO.FileInfo]$FileInfo
|
||||
)
|
||||
|
||||
process {
|
||||
$content = Get-Content -Raw -Encoding Unicode -Path $FileInfo.FullName
|
||||
[System.IO.File]::WriteAllText($FileInfo.FullName, $content, [System.Text.Encoding]::UTF8)
|
||||
}
|
||||
}
|
||||
|
||||
function ConvertTo-SpaceIndentation() {
|
||||
[CmdletBinding()]
|
||||
[OutputType([void])]
|
||||
param(
|
||||
[Parameter(Mandatory, ValueFromPipeline)]
|
||||
[System.IO.FileInfo]$FileInfo
|
||||
)
|
||||
|
||||
process {
|
||||
$content = (Get-Content -Raw -Path $FileInfo.FullName) -replace "`t", ' '
|
||||
[System.IO.File]::WriteAllText($FileInfo.FullName, $content)
|
||||
}
|
||||
}
|
||||
|
||||
function Get-TextFilesList {
|
||||
[CmdletBinding()]
|
||||
[OutputType([System.IO.FileInfo])]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string]$Root
|
||||
)
|
||||
Get-ChildItem -Path $Root -File -Recurse |
|
||||
Where-Object { @('.gitignore', '.gitattributes', '.ps1', '.psm1', '.psd1', '.json', '.xml', '.cmd', '.mof') -contains $_.Extension }
|
||||
}
|
||||
|
||||
function Test-FileUnicode {
|
||||
[CmdletBinding()]
|
||||
[OutputType([bool])]
|
||||
param(
|
||||
[Parameter(Mandatory, ValueFromPipeline)]
|
||||
[System.IO.FileInfo]$FileInfo
|
||||
)
|
||||
|
||||
process {
|
||||
$path = $FileInfo.FullName
|
||||
$bytes = [System.IO.File]::ReadAllBytes($path)
|
||||
$zeroBytes = @($bytes -eq 0)
|
||||
return [bool]$zeroBytes.Length
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function Get-UnicodeFilesList() {
|
||||
[CmdletBinding()]
|
||||
[OutputType([System.IO.FileInfo])]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string]$Root
|
||||
)
|
||||
|
||||
Get-TextFilesList $Root | Where-Object { Test-FileUnicode $_ }
|
||||
}
|
3
tests/ScriptAnalyzerSettings.psd1
Normal file
3
tests/ScriptAnalyzerSettings.psd1
Normal file
@ -0,0 +1,3 @@
|
||||
@{
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user