2013 – Javascript : Retrieve an item value from SP List

Before explaining my problem, I give you the context.

I’ve made an first page that will display a “Marquee” message (message that will scroll horizontally).

I would like to make possible to edit the “Marquee message” from an another page.
So, I’ve created an other page with a textarea and a button.
When I write a text and click on the button, an item is created in a list called “MarqueeList”.

That list contain only the last message that we create : my script delete all the items before add a new one.

My problem is that I would to get that message item, using a script from the page that contain the marquee, and store it into a variable.

I’ve tried many and any script, but it doesn’t work.

If someone could help me, or advise me to the good way?

Thanks a lot

Looping through a SharePoint List to compare a field value with another List Item ID in Powershell

I have two Lists. A Calendar Lists and a Custom List
In one List I have multiple records all with an ‘EventID’ field which relates to a Calendar record (The record ID)

I am trying to use PowerShell to recurse through each Custom List record and check to see if the ‘EventID’ has a relating ‘Calendar ID’ in the Calendar record. If not, it means the Calendar entry has been deleted and the ‘Orphaned’ field in the Custom List record should be set to ‘YES’. There may be multiple records in the Custom List per Calendar Entry. I need to update ALL records WITHOUT a valid Calendar Entry to ‘Orphaned’.

Although not finished, so far I have this code, but I’m sure there must be a better way to do this, and a different way so that once a MISSING ‘EventID’ is found (the Calendar entry is deleted) then the loop stops and moves on to the next Calendar entry. My mind has just gone blank.

cls
#Add Snapin
Add-PSSnapin Microsoft.SharePoint.PowerShell -EA SilentlyContinue

Start-Transcript -Path "D:SharePointScriptsEmailTranscript.txt"

#Set Variables
$spWeb = Get-SPWeb -Identity "http://ds.stylus.com"
$PClist = (Get-SPWeb "http://ds.stylus.com").Lists("PreventionCalendar")
$DElist = (Get-SPWeb "http://ds.stylus.com").Lists("DirectEngagement")
$DEvID = "EventID"
$DEvStatus = "Status"

#Get Today's Date - var: $now
$now = Get-Date 
Write-Host "Today is:" $now

$PCitems = $PClist.Items
#show the item count for the library
Write-Host "PreventionCalendar - Total Records: $($PCitems.count)"

$DEitems = $DElist.Items
#show the item count for the library
Write-Host "DirectEngagement - Total Records: $($DEitems.count)"

if($PCitems.count -lt 1)
{
    foreach($item in $DEitems)
    {   
       $DEID = $item.ID
       #Get the DE Status value
       $DEvStat = $item($DEvStatus)
       #Get the DE EventID value
       $DEvIDent = $item($DEvID)           
                
       Write-Host "PreventionCalendar is Empty. Orphan Appliance"
       $SPListItem = $DElist.GetItemById($DEID)
       $SPListItem("Status") = "Appliance Orphaned"
       $SPListItem.Update()
     }
}
elseif($PCitems.count -ge 1)
{

    foreach($item in $DEitems)
    {
        $DEID = $item.ID
        #Get the DE Status value
        $DEvStat = $item($DEvStatus)
        #Get the DE EventID value
        $DEvIDent = $item($DEvID) 

        Write-Host -Foregroundcolor Green "Checking..... Appliance ID:" $DEID "EventID:" $DEvIDent 

            foreach($item in $PCitems)
            {
                $PCID = $item.ID
                Write-Host -Foregroundcolor Red "IF 'EventID'" $DEvIDent "EQUALS 'CalendarID'" $PCID "run.." 
                
                if($DEvIDent -eq $PCID)
                {
                    Write-Host "Appliance ID:" $DEID "EventID:" $DevIDent "Matched with PreventionCalendar ID:" $PCID
                    {break}
                }
                else
                {
                    Write-Host "Appliance ID:" $DEID "EventID:" $DevIDent "PreventionCalendar ID: No Match Found"
                }
            }
            
        
        
                
     }          
                
                
}

Write-Host "Orphaned Appliances Updated"

Any help would be appreciated.

Rick

event handlers – Build and package app to trigger automated email upon added list item

I am a sharepoint beginner and am looking to create something that will trigger an automated email upon adding a list item to an existing sharepoint list. What should I be creating to help with this (solution/addin/app)? and how should i go about doing so? I am developing with another laptop to build and transfer to another laptop with sharepoint access to deploy. Would it be done through uploading of webpart? if not how would i upload it?

Restraints:
Has to be within sharepoint (sharepoint hosted?)
Unable to install software in sharepoint access computer
I am only a site owner.

javascript – Como excluir um item da Lista via SweetAlert e Ajax

tudo bem?

Estou brincando com SweetAlert, e preciso que ao confirmar, o método ajax possa ir ao controller e excluir um item.

Alguém pode me ajudar a resolver?inserir a descrição da imagem aqui

Estou usando .Net Core MVC, Razor Pages e enfim, ainda estou aprendendo JQuery com ajax, mas infelizmente não consigo.

Basicamente, o que eu queria era:

Quando apertasse o botão de confirmação, via ajax ir ao controller e excluir o item, mas não consigo avançar nisso.
Alguém pode me ajudar?

Meu botâo:

<a asp-action="Delete" id="Delete" class="btn btn-info" asp-route-id="@game.Id" onclick="return functionConfirm(this)">Delete</a>

Meu Controller:

public ActionResult Delete(Guid? id)
        {
            var game = UnitOfWork.Game.Get(id);
            UnitOfWork.Game.Delete(game);
            UnitOfWork.SaveChanges();

            return RedirectToAction("Index");
        }

Meu Jquery => Ajax:

<script type="text/javascript">
            function functionConfirm(event) {
                event.preventDefault();
                swal({
                        title: "Exclusão",
                        text: "teste",
                        type: "warning",
                        showCancelButton: true,
                        confirmButtonClass: "btn-danger",
                        confirmButtonText: "Yes, delete it!",
                        cancelButtonText: "No, cancel plx!",
                        showLoaderOnConfirm: true,
                        animation: 'slide-from-top',
                        allowEscapeKey: false,
                        allowOutsideClick: false,
                        html: true
                    },
                    function (isConfirm) {
                        if (isConfirm) {
                            //Do your stuff if clicked yes.
                            $.ajax({
                                type: "POST",
                                url: "Game/Delete",
                                data: "Data you want to pass",
                                contentType: "application/json; charset=utf-8",
                                dataType: "json",
                                success: function (response) {
                                    //response will return the value you assigned while returning on success call of ajax.
                                },
                                error: function (response) {
                                    // reponse will return server side error message.
                                }
                            });               
                        } else {
                            //Do your stuff if clicked No.
                        }
                    });
            }
    </script>

O que posso fazer pra melhorar e passar o ajax pra minha controller?

dnd 5e – Could this magic item help Ezmerelda in Curse of Strahd?

In the Curse of Strand adventure, the following information is provided about the NPC Ezmerelda in Appendix D (p. 231):

Ezmerelda’s Secret … On one of her less successful adventures, a werewolf bit off her right leg below the knee, and although she avoided being afflicted with lycanthropy, Ezmerelda was sidelined for months. She commissioned a master artisan to craft a prosthetic lower leg and foot. After several tries, he delivered a prosthesis that restored her mobility. She has since adapted well to the false appendage and takes care to hide it from view.

There’s also this magic item that can be found in the village of Krezk (p. 148):

Sun’s Grave
The gravestone marked X is carved with roses and bears a 3-inch-diameter sun-shaped indentation on its east side. Engraved beneath the indentation is the name PETROVNA. If Tasha Petrovna’s holy symbol (see chapter 4, area K84, crypt 11) is placed in the indentation, both the holy symbol and the indentation vanish. Then read:

A ray of golden sunlight breaks through the clouds to the west and shines upon the grave. The fog and the gloom shrink from its brilliance as the sunlight causes the gravestone to crack and crumble, revealing a ring within.

The sunray lasts for 1 minute. If the characters smash the gravestone without placing Tasha Petrovna’s holy symbol in it first, they find nothing within its remains. The ring is a ring of regeneration.

The description of this magic item in the DMG says (p. 191):

While wearing this ring, you regain 1d6 hit points every 10 minutes, provided that you have at least 1 hit point. If you lose a body part, the ring causes the missing part to regrow and return to full functionality after 1d6 + 1 days if you have at least 1 hit point the whole time.

So the question is:

If the party found this ring of regeneration and gave it to Ezmerelda (either by coincidence or because they learned of her “secret” and wanted to help), would her missing leg grow back? Is there any reason this wouldn’t work (such as due to the length of time her leg has been missing, or the fact that her leg has now been replaced by a fully functioning prosthetic)?

rest api – Uploading a media item with the wp-json API to a specific path

I’m using the WP-JSON API to import all my posts from my live site to my development site. It’s working fine for posts, categories and authors, but when I upload my images, the API treats the files as having been uploaded that day (so for example, as we’re in June 2020, the files all go to wp-content/uploads/2020/06), which results in broken image links. How can I upload files as if they’re uploaded on the same date as the source file?

Here’s what I have so far (where $MEDIA is a response from my production server to /wp-json/wp/v2/media to list all my media files):

# Loop through the JSON response (encoding as base64, so each object is on a seperate line)
for media in $(printf %s "$MEDIA" | jq -r ".() | @base64")
do
  media_body=$(printf %s "$media" | base64 -D)
  # Get URL and destination path
  source_url=$(printf %s "$media_body" | jq .source_url | tr -d '"')
  destination_path=$(printf %s "$media_body" | jq .media_details.file | tr -d '"')

  filename=$(basename "$destination_path")

  # Download media file to tmp directory
  curl -s "$source_url" > "/tmp/$filename"

  # Upload the media file to my dev server (store the response as a variable so we can get the ID)
  response=$(curl --request POST "http://localhost/wp-json/wp/v2/media/" 
    -u admin:admin 
    -s 
    --header "cache-control: no-cache" 
    --header "content-disposition: attachment; filename=$filename" 
    --data-binary "@/tmp/$filename" 
    --location)

  id=$(printf %s "$response" | jq -r ". | .id")
  body=$(printf %s "$media_body" | jq -r ". | {date: .date, date_gmt: .date_gmt, slug: .slug, status: "publish", title: .title.rendered}")

  # This outputs body eg {"date": "2020-05-27T12:12:53", "date_gmt": "2020-05-27T12:12:53", "slug": "cropped-shortcut-icon-png", "status": "publish", "title": "cropped-shortcut-icon.png" }

  # Update the image's metadata
  curl --location --request POST "http://localhost/wp-json/wp/v2/media/$id" 
    -u admin:admin 
    -s -o /dev/null 
    --header 'Content-Type: application/json' 
    --data-raw "$body"
done

sharepoint designer – Get the ID of a List Item copied during a workflow

You can’t, but you can do the reverse. Using the Copy item action does not give you any useful return value to be able to reference the copied item. But, what you can do is add a number field (maybe called OriginalItemID? And maybe make it hidden so that user’s can’t edit the value?) to the library where you are making the copies. Then, right after you have initially copied the document, set the copy’s OriginalItemID field to be the ID of the current item.

Then when the workflow runs again, you can find the copy based on the OriginalItemID value matching the current item ID.

table – Building an array of T NxM matrices where one item in each matrix changes

As I do not use Mathematica often enough, I am a bit rusty. I need to work on an array of T matrices and each of those NxM matrices has the following pattern:

<span class=begin{equation}
A(t):=
left(
begin{array}{cccc}
alpha_1(t) +beta(t) +bar{beta}(t) & beta(t)+bar{beta}(t) & … & beta(t)+bar{beta}(t) \
beta(t)+bar{beta}(t) & {alpha}_2(t) +beta(t)+ bar{beta}(t) & … & beta(t)+bar{beta}(t) \
… & … & … & … \
beta(t)+bar{beta}(t) & beta(t)+bar{beta}(t) & … & alpha_N(t)+beta(t)+bar{beta}(t)
end{array}
right)
end{equation}” />

where the alpha_1(t),beta(t) and bar{beta} are vectors of size T. As can be seen, in each matrix only the diagonal changes as the alpha_i(t) are added, with i in {1,N}, and t in {1,T}.
I am sure that the solution must be reasonably easy, but not for me.
Thank you.

dnd 5e – Is there an item in DND 5e that will cast Alter Self?

The 5th level party I DM for just found a Hat of Disguise. Our Rogue (Thief Archetype) is fascinated by the endless possibilities, but slightly put off by the shortcomings of the Disguise Self spell it casts. She has had a conversation with our spellcasters, and her player has asked me whether they could find an item that would cast the more powerful Alter Self spell. I see much potential for entertaining mayhem in this.

Is there an item that casts Alter Self, say, once a day? Even homebrew? (If I can’t find anything official, I’ll homebrew it anyway.)

I have skimmed through the DMG and only found the Wand of Polymorph, which isn’t quite what we had in mind. The Infiltrator’s Key is way overpowered for this.