SharePoint ElementPlus 进行 el-select 远程搜索

1.SharePoint 人员搜索

2.el-select远程搜索

创建el-select时勾选

SharePoint 远程搜索 

<script lang="ts" setup>
import { getCurrentInstance, onMounted, ref } from "vue";
import "@pnp/sp/webs";
import "@pnp/sp/lists";
import "@pnp/sp/items";
import "@pnp/sp/profiles";
import "@pnp/sp/sputilities";
import "@pnp/sp/site-users/web";
import "@pnp/sp/site-groups";
// 获取当前实例并提取需要的属性和方法
const { proxy } = getCurrentInstance();
const sp = proxy.$SP;
interface ListItem {
  value: string;
  label: string;
}
const list = ref<ListItem[]>([]);
const options = ref<ListItem[]>([]);
const value = ref<string[]>([]);
const loading = ref(false);
onMounted(() => {
  list.value = states.map((item) => {
    return { value: `value:${item}`, label: `label:${item}` };
  });
});

//远程搜索
const remoteMethod = async (query: string) => {
  if (query) {
    // 设置加载状态为 true,表示开始加载
    loading.value = true;
    // 使用 SharePoint Profiles API 的 clientPeoplePickerSearchUser 方法搜索用户
    const value = await sp.profiles.clientPeoplePickerSearchUser({
      SharePointGroupID: 0,
      AllowEmailAddresses: true,
      AllowMultipleEntities: false,
      AllUrlZones: false,
      MaximumEntitySuggestions: 50,
      PrincipalSource: 15,
      PrincipalType: 1,
      QueryString: query,
    });
    // 将返回的用户数据映射为对象,并存储在 Options.value 中
    options.value = value.map((user) => ({ value: user.Key, label: user.DisplayText, EntityData: user.EntityData }));
    console.log(options.value);
    console.log(value);

    loading.value = false;
  }
};

实现sharepoin人员搜索

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值