Peoplecode function not working - oracle

I am using Peoplecode which is a Peoplesoft coding language.
I am trying to access JUST the 'message text' from a message catalog.
It pulls the correct number 7373 when I use the same code on another page.
But in this instance it returns the message
'GetMessageText: No default message. (2012,2012)'.
Here is the code I am using..
&cur_year = Year(%Date);
&MsgNum = MsgGetText(2012, 2012, "");

It's because it can't find the message (2012,2012). You have to specify the correct message set and message number to retrieve from the message catalog.
Look here:
http://docs.oracle.com/cd/E28394_01/pt852pbh1/eng/psbooks/tpcl/book.htm?File=tpcl/htm/tpcl02.htm%2337ee99c9453fb39_ef90c_10c791ddc07__3cd3

Related

"telegram.error.BadRequest: Wrong file identifier/http url specified" when trying to send certain URLs

I have this function that basically sends messages to a chat group in telegram with data from new documentaries.
chat_id = *chat_number*
images = 'https://m.media-amazon.com/images/M/MV5BZGZjZDg0MzYtY2NhNy00YjM4LWI2YzQtYTk4Zjk0ZmRiY2VmXkEyXkFqcGdeQXVyOTU1MTMxOQ##._V1_.jpg'
message = bot.send_photo(chat_id, images, caption = text, parse_mode = 'HTML')
Normally it works but this link in particular (also another ones) raises an error in telegram. How could I do to avoid this error? I dont want to turn the url into a file and sending afterwards, there's any other option?
this is the error:
raise BadRequest(message)
telegram.error.BadRequest: Wrong file identifier/http url specified

Attempting to read and download Outlook emails in jupyter notebook using win32

Two-fold issue: 1) Trying to download attachments from Outlook emails using win32 in Jupyter Notebook 2) I get notifications of different lessons and resources by phone. Then I usually, send the URL to the resource to my email to organize later on. Is there a way to use Jupyter Notebook to grab these emails and store them in an excel file? Here is the lesson I am trying to follow currently: https://towardsdatascience.com/automatic-download-email-attachment-with-python-4aa59bc66c25 . And here is my code:
import win32com.client
outlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI")
inbox = outlook.GetDefaultFolder(6)
messages = inbox.items
message = message.GetFirst()
attachments = message.Attachments
attachment = attachments.Item(1)
attachment_name = str(attachment).lower() attachment.SaveAsFile(path + '\\' + atttachment_name)
exit
You never check that a message has attachments (message.Attachments.Count > 0) and you assume that you get a particular message from the Inbox: can either get the currently selected message (Application.ActiveExplorer.Selection collection) or you need to search for the particular message using Items.Find/FindNext or Items.Restrict. Items.GetLast will give some undetermined item.
Thirdly, the line message = message.GetFirst() was probably meant to be message = messages.GetFirst(). Still won't work, but at least it won't blow up because message variable is uninitialized.

Powershell and IBM/Lotus Domino

I have written 9 routines in the last few weeks in Powershell for Domino, they all appear to do what I need except 1!
This is the RegisterNewUser method, which does everything except the Email address. If I setup a user via Domino Administrator, I get everything including the email address ie internal address that is 'bob patz/smallhome'.
If I use my code this uses the registration process but all I end up with is the domain part of the internal email address '#smallhome'.
Does anyone know how to correct this? I don't think powershell uses the #formula language in any form, so I assume i somehow need to find the right column in a document or database and append the fullname in there somehow.
Is there anyone out there who can help in anyway?
regards
Mark
<#TOP TIP: THIS MUST RUN UNDER POWERSHELL (X86), ELSE IT WILL NOT WORK!!
This Powershell Function was created in March 2020 by (myself) Mark Baker as 'a' just to see if I can de-mystify
some of the Domino Database stucture, after running short bits of code and using Get-Member on some parts
of it and looking at online code snippets and reading some of the online info from IBM I have come up with
the function below to Create a New Lotus Notes User.
#
Original Code: 31/03/2020 by MBaker
A lot of work testing and diagnosing the different settings and values EVENTUALLY lead me to getting this working,
as at 08/04/2020 I just need to work out the settings for setting the correct email address per person.
#
This is how to use this function:
New-DominoUserRegistration "hazell" "C:\Program Files\IBM\Lotus\Notes\Data\ids\people\dhazell.id" "CN=Dom-01/O=Smallhome"
"Daniel" "" "swindon" "Work" "comment" "mail\dhazell" " " "password" 176
"dhazell"
Main use of this function is to connect to an IBM Domino Server and Create a New lotus notes user.
>
Function New-DominoUserRegistration {
[cmdletbinding()]
param (
[parameter(Position=0,Mandatory=$true,ValueFromPipeline=$True)][string]$lastname,
[parameter(Position=1,Mandatory=$true,ValueFromPipeline=$True)][string]$Useridfile,
[parameter(Position=2,Mandatory=$true,ValueFromPipeline=$True)][string]$mailserver,
[parameter(Position=3,Mandatory=$true,ValueFromPipeline=$True)][string]$firstname,
[parameter(Position=4,Mandatory=$false,ValueFromPipeline=$True)][string]$middle,
[parameter(Position=5,Mandatory=$true,ValueFromPipeline=$True)][string]$certpw,
[parameter(Position=6,Mandatory=$true,ValueFromPipeline=$True)][string]$location,
[parameter(Position=7,Mandatory=$true,ValueFromPipeline=$True)][string]$comment,
[parameter(Position=8,Mandatory=$true,ValueFromPipeline=$True)][string]$maildbpath,
[parameter(Position=9,Mandatory=$true,ValueFromPipeline=$True)][string]$fwddomain,
[parameter(Position=10,Mandatory=$true,ValueFromPipeline=$True)][string]$userpw,
[parameter(Position=11,Mandatory=$true,ValueFromPipeline=$True)][int]$usertype,
[parameter(Position=12,Mandatory=$true,ValueFromPipeline=$True)][string]$ShortName
)
cls
# Create Lotus Notes Object
$DomSession = New-Object -ComObject Lotus.NotesSession
# Initialize Lotus Notes Object
# "It'll use your open notes session and authentication Details"
$DomSession.Initialize()
# Use Method from Objects returned in variable $domsession one of which is CreateAdministrationProcess which
# takes a Server as input
$adminProcess = $Domsession.CreateRegistration()
$expiration = (Get-Date).adddays(1095)
$adminprocess.certifieridfile="C:\Program Files (x86)\IBM\Lotus\Notes\Data\ids\cert.id"
$adminprocess.Expiration =$expiration
#$adminprocess.RegistrationLog ="C:\program files (x86)\IBM\lotus\notes\data\reglog.nsf"
#[int]$adminProcess.MinPasswordLength=5
$adminprocess.RegistrationServer="Dom-01/smallhome"
$adminprocess.UpdateAddressBook=$true
$adminProcess.GroupList="Test4"
#$adminProcess.CreateMailDb=$true
#[int]$adminProcess.MailQuotaSizeLimit="100"
#[int]$adminProcess.MailQuotaWarningThreshold="90"
$adminProcess.PolicyName="/Registration_Settings"
$adminProcess.ShortName=$ShortName
[int]$adminProcess.MailOwnerAccess=2
$adminProcess.MailACLManager="LocalDomainAdmins"
$adminProcess.MailInternetAddress="$ShortName"+"#smallhome.local"
$adminProcess.MailTemplateName="Mail85.ntf"
$Notesid=$adminprocess.RegisterNewUser($lastname,$Useridfile,$mailserver,$firstname,$middle,$certpw,$location,$comment,$maildbpath,$fwddomain,$userpw,$usertype)
}
New-DominoUserRegistration "archer" "C:\Program Files (x86)\IBM\Lotus\Notes\Data\ids\people\barcher.id" "CN=Dom-01/O=Smallhome" "basil" "" "swindon" "Work" "comment" "mail\barcher" " " "password" 176 "barcher"
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/2Wamq.png
I now have an answer for this, this came from someone else on another board: the line [parameter(Position=9,Mandatory=$true,ValueFromPipeline=$True)][string]$fwddomain,
Needed to have [AllowEmptyString()] inserted before [string]$fwddomain, and the input field was " " and needed to be "". It appears the $fwddomain has an impact on the internal email address name ie: 'bob patz/smallhome'.
I have tested this and it shows up in the people view and also I can now send emails to other users and ones self!
Problem solved.
Regards
Mark

SonarJs still shows warning about postMessage cross-domain issue

The error message is "make sure this cross-domain message is being sent to the intended domain".
This check rule from RSPEC-2819
Authors should not use the wildcard keyword ( *) in the targetOrigin argument in messages that contain any confidential information, as otherwise there is no way to guarantee that the message is only delivered to the recipient to which it was intended.
I assume it demands * cannot be used as targetOrigin, But It still shows warning when I use intended domain as targetOrigin like below:
Please somebody can tell me how to pass this check,
Any help would be appreciated
This rule detects only if a method postMessage is invoked on an object with a name containing window in it. Source code: PostMessageCheck.java. To bypass it, just assign your contentWindow object into different one, like this:
var content = this.elem.contentWindow;
content.postMessage('your message', window.location.origin);
Have faced similar issue in sonarQube. Below fix worked. Just get rid of using window object using directly.
Actual code:
window.parent.postMessage("data", parenturl);
Fix:
var content=window;
content.parent.postMessage("data",parenturl);

The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted

I'm trying to send a message to a queue using a Message object and am getting the error
The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted.
Here is the code.
Order ord = new Order(new Guid(), "Smith & Smith");
Message orderMessage = new Message(ord);
orderMessage.UseEncryption = true;
orderMessage.EncryptionAlgorithm = EncryptionAlgorithm.Rc2;
orderMessage.Recoverable = true;
orderMessage.Priority = MessagePriority.VeryHigh;
orderMessage.TimeToBeReceived = TimeSpan.FromHours(1);
orderMessage.UseJournalQueue = true;
orderMessage.Body = "Test Encryption";
queue.Send(orderMessage, "Encrypted Order");
Any help with this is appreciated.
Tom
Did you ever solve this? I came across this problem myself and found out I needed to use (just like the error says) a different format name.
The strange thing was that if I set UseAuthentication property using the MQ certificate, then it worked. But if I also wanted to set UseEncryption, then it did not work.
You do not specify your queue/server setup/formats, but I suspect you're trying to send from one machine to another machine's public queue within the same domain, using DIRECT formatname? As the MQ Manager will use the domain AD to lookup the certificate and queue details, it raises an exception as the format name is invalid (not the same as specified in the AD). So instead of using the direct format, use the queue ID to define the formatname. I switched this:
"FormatName:Direct=TCP:111.222.1.22\your_public_queue"
with this:
"FormatName:PUBLIC=7EB2A53C-7593-462C-A568-5A0EFA26D91D"
Now it worked. You can find your queue ID by right-clicking your queue on the receiver machine and then go to Properties->General and see the value specified in field "ID".
I have found that getting the FormatName correct whether public or private in nature will save hours of work. It's incredibly important to understand the setup of each (Public requiring AD and private does not when access remotely). This is a great summary of FormatName.
https://blogs.msdn.microsoft.com/johnbreakwell/2009/02/26/difference-between-path-name-and-format-name-when-accessing-msmq-queues/
One note on this issue, if your queue format name starts this way: "FormatName:Direct=" then you will receive the error "The specified format name does not support the requested operation. For example, a direct queue format name cannot be deleted" if you try to access the queue's QueueName property. Use the queue's FormatName property instead.

Resources