我可以使用 Visual Studio 在 SharePoint 中循环列表吗?
(使用 SharePoint 2010)
大家好,我将尽力提供足够的背景知识,让这一点有意义。
基本上我们有一份客户名单及其电话号码和其他信息。该列表按过期日期排序。我们有电话营销人员给此列表中的客户打电话。到目前为止,我们只有一位电话营销员给列表中的客户打电话,没有出现任何问题。然而,现在我们希望列表中有两个 tm 的呼叫客户,并且将来可能会有更多。当然,问题是我们不希望他们同时呼叫相同的客户。
我们可以通过将 TM 分配给列表中的每个客户来解决此问题,然后他们只能看到分配给他们的客户。但由于我们想按一定的顺序调用它们,我们也想按顺序分配 tm,例如:
假设我们有 3 个 tm 的调用。理想情况下,该列表应如下所示(TM1、2 和 3 是将分配给该客户的 tm):
- Cust#1 - TM1
- Cust#2 - TM2
- Cust#3 - TM3
- Cust#4 - TM1
- Cust#5 - TM2
- 客户#6 - TM3
- 客户#7 - TM1
- 客户#8 - TM2 ... 等等。
现在的窍门是,有些日子我们可能会接到 1 个 tm 的呼叫,或者 3 个 tm 的呼叫。因此,每天早上在开始之前,TM 管理员必须将呼叫分配给不同的 TM。当列表中有 1000 多个客户时,这会变得很棘手。当然,我们可以将列表切换到数据视图,然后从 Excel 工作表中复制并粘贴值以进行分配。或者我们可以在 Access 中打开它并针对它运行脚本。但是有没有一种方法可以在 Visual Studio 中编写工作流程(或其他内容)来为我循环遍历列表并执行此操作?我需要向它提供一个数字,表示有多少个 tm 将呼叫,然后它将循环遍历客户列表并以上面指定的方式分配 tm。
如果您能想到更好的方法来做到这一点,我也愿意接受其他想法。提前致谢!
(Using SharePoint 2010)
Hi guys, I'll try to give enough background for this to make sense.
Basically we have a list of customers with their phone numbers and other info. This list is sorted by an overdue date. We have telemarketer staff that call the customers in this list. So far we've had only one telemarketer calling the customers in the list which presents no problems. Now however we want to have two tm's calling customers in the list, and possibly more in the future. Of course the problem is we don't want them calling the same customers at the same time.
We can solve this by assigning tm's to each customer in the list, then they only see the customers they are assigned to. But since we want to call them in a certain order we would want to assign the tm's in order as well, for example:
Assume we have 3 tm's calling. The list would ideally look as follows (TM1, 2, and 3 are the tm's that would be assigned to that customer):
- Cust#1 - TM1
- Cust#2 - TM2
- Cust#3 - TM3
- Cust#4 - TM1
- Cust#5 - TM2
- Cust#6 - TM3
- Cust#7 - TM1
- Cust#8 - TM2
... and so on.
Now the trick is that some days we may have 1 tm calling, or 3 tm's calling. So each morning before they begin the tm admin would have to assign the calls to different tm's. This get's tricky when there's 1000+ cusomters in the list. Sure we could switch the list to data view and copy and paste values in from an Excel sheet to make the assignments. Or we could open it in Access and run a script against it. But is there a way I could program a workflow (or something) in Visual Studio to loop through the list for me and do this? I would need to provide it a number representing how many tm's would be calling and then it would loop through the list of customers and assign the tm's in the fashion designated above.
If you can think of a better way to do this I'm open to other ideas too. Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您绝对可以循环遍历列表中的项目。以下是一种实现方法的示例:
剩下的唯一问题是如何执行此代码。您可以将其放入控制台应用程序并在服务器上运行(不推荐),或者您可以将其放入 Web 部件中,将其粘贴在页面上,授予管理员对该页面的访问权限(可能带有随附的表单),然后让(他/她)每天(或当数据发生变化时)执行它。
You can absolutely loop through the items in a list. Here's an example of one way you could do it:
The only question that remains is how to execute this code. You could put this in a console application and run it on the server (not recommended), or you could put it in a webpart, stick it on a page, grant the admin access to the page (perhaps with an accompanying form), and have (him/her) execute it daily (or when the data changes).